Title: using in_array for OR
Last modified: December 10, 2019

---

# using in_array for OR

 *  Resolved [jman057](https://wordpress.org/support/users/jman057/)
 * (@jman057)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/using-in_array-for-or/)
 * Hi there, first off, great plugin! This is changing the way I work with Elementor!
 * My challenge: I need to show/hide an element based on one or more Product Categories.
   I can do this successfully for one category when using the condition: Contains.
   For example:
 * Dynamic Tag: Product Terms > Category
    Condition: Contains Condition value: “
   Venues” = TRUE
 * However, I need the condition to be met when the product belongs to other categories
   also. E.g., Venues OR Transport
 * I have tried the Condition: In array, however, this doesn’t seem to work. For
   example, on the same item as above:
 * Dynamic Tag: Product Terms > Category
    Condition: In array Condition value: “
   Venues” = FALSE (which seems strange)
 * I would really like to be able to do this:
 * Dynamic Tag: Product Terms > Category
    Condition: In array Condition value: “
   Venues, Transport” = TRUE (only if the product belongs to Venues OR Transport
   category)
 * Does that make sense? Is this how In array should work?
 * Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [rtowebsites](https://wordpress.org/support/users/rtowebsites/)
 * (@rtowebsites)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/using-in_array-for-or/#post-12226507)
 * Hey [@jman057](https://wordpress.org/support/users/jman057/)
 * we maybe found a solution for you. But it depends on one thing! Every product
   can have only 1 category to get work (or you have to add the pairs too). We tested
   it on post categories, should be the same as product categories.
 * You dd nearly everything right, but if you enable the Debug-Mode, you will see,
   elementor will wrap the category with a span element. So have to add the Conditional
   value with the tag: <span>Venues</span>, <span>Transport</span>.
 * Because of the full matching it only works when there is not more than 1 category
   or you have to add the pairs too like: <span>Venues</span>, <span>Transport</
   span>, <span>Venues</span><span>Transport</span>, <span>Transport</span><span
   >Venues</span>. (important: remove the “,” Seperator in the Product Term!)
 * Would be nice if you can report us if it worked. Thank you.
 *  Plugin Author [rtowebsites](https://wordpress.org/support/users/rtowebsites/)
 * (@rtowebsites)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/using-in_array-for-or/#post-12241913)
 * Since there is no more informations, we close this issue.
 * If you need any further help, rewrite here or open a new issue.
 * Thank you!
 *  Thread Starter [jman057](https://wordpress.org/support/users/jman057/)
 * (@jman057)
 * [6 years, 5 months ago](https://wordpress.org/support/topic/using-in_array-for-or/#post-12263257)
 * Hi, thanks for your reply, and apologies for taking a while to respond (I missed
   the notification).
 * I’ve given this a try but it seems to still not quite work. I’ve used the debug
   mode and copy-pasted the comparison string including the wrapping a tag.
 * By using the debug-mode, and testing with a single category, I am generating 
   the following debug info which shows that the condition is not being met.
 * (Settings = Show when condition met, In array, Text)
 * Thanks in advance!
 *     ```
       Element:section-f139786 (section)
       DynamicTag-Tag:woocommerce-product-terms-tag
       DynamicTag-Key:
       DynamicTag-Value:Categories: <a href="https://woocommerce-207249-1003603.cloudwaysapps.com/product-category/professionals/venues/" rel="tag">Venues</a>
       Check-Value:<a href="https://woocommerce-207249-1003603.cloudwaysapps.com/product-category/professionals/venues/" rel="tag">Venues</a>
       Check-Value2:
       Condition-Type:default
       Condition:Show if in_array
       Condition met:no
       ```
   
    -  This reply was modified 6 years, 5 months ago by [jman057](https://wordpress.org/support/users/jman057/).
    -  This reply was modified 6 years, 5 months ago by [jman057](https://wordpress.org/support/users/jman057/).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘using in_array for OR’ is closed to new replies.

 * ![](https://ps.w.org/dynamicconditions/assets/icon-256x256.jpg?rev=1969812)
 * [Dynamic Conditions](https://wordpress.org/plugins/dynamicconditions/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dynamicconditions/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dynamicconditions/)
 * [Active Topics](https://wordpress.org/support/plugin/dynamicconditions/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dynamicconditions/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dynamicconditions/reviews/)

## Tags

 * [product categories](https://wordpress.org/support/topic-tag/product-categories/)

 * 3 replies
 * 2 participants
 * Last reply from: [jman057](https://wordpress.org/support/users/jman057/)
 * Last activity: [6 years, 5 months ago](https://wordpress.org/support/topic/using-in_array-for-or/#post-12263257)
 * Status: resolved