Title: Variations conditional logic
Last modified: March 29, 2020

---

# Variations conditional logic

 *  Resolved [bynejc](https://wordpress.org/support/users/bynejc/)
 * (@bynejc)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/variations-conditional-logic/)
 * Hello,
 * I have been trying a lot of plugins regarding this question and no plugin is 
   good enough for what im trying to do. (Gravity forms, Exta Product options, YITH
   product add on options..). I have been trying to do this for a few days with 
   no results. I have little knowledge of the code.
 * All of these plugins is not what I am looking for. I want to create three ‘quanitity
   boxes’ (like on these sites: [https://www.kupi-hitro.si/izdelek/brezzicne-slusalke/](https://www.kupi-hitro.si/izdelek/brezzicne-slusalke/)
   or [https://vigoshop.si/izdelek/pametno-drzalo-z-brezzicnim-polnjenjem-deluxe/](https://vigoshop.si/izdelek/pametno-drzalo-z-brezzicnim-polnjenjem-deluxe/))
 * Basically three quantity selection boxes with conditional logic. If a customer
   chooses quantity box 2 the button opens two swatch options, if a customer selects
   quantity 3, three swatch options show.
 * This is what im going for. I cant seem to find the plugins, do you think this
   is custom code?
 * Thank you for your help.

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

 *  [linux4me2](https://wordpress.org/support/users/linux4me2/)
 * (@linux4me2)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/variations-conditional-logic/#post-12599202)
 * I may be misunderstanding what you’re trying to accomplish, but I think WooCommerce
   will do this for you out-of-the box using variable products with the relevant
   attributes.
 * For example, you’d create two attributes, quantity and swatches. The quantity
   attribute would have values “1|2|3”. The swatches would have the values you want
   for them, say “red|yellow|green|blue”. Next, you’d create variations combining
   the quantities and swatches that correspond. When you’re done, the customer’s
   choice of quantity will only show the swatch values that you paired with it.
 * There is one “gotcha” you have to be cautious with. By default, the variations
   threshold is 30. If the number of variations is less than the threshold, WooCommerce
   uses AJAX to check the available variations on the fly, and the user interface
   will work the way you want it.and the customer is only able to select available
   variations. If the number of variations is greater than the threshold, AJAX isn’t
   used, and the customer may get the “unavailable variation” message.
 * If you have more than 30 variations for a product, you can increase the threshold
   by adding the following code to your child theme’s functions.php, replacing the“
   150” with whatever you need, but keeping in mind the higher the number, the more
   resource-intensive the AJAX call:
 *     ```
       add_filter( 'woocommerce_ajax_variation_threshold', 'wc_ajax_variation_threshold' );
       function wc_ajax_variation_threshold() {
           return 150;
       }
       ```
   
 *  Thread Starter [bynejc](https://wordpress.org/support/users/bynejc/)
 * (@bynejc)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/variations-conditional-logic/#post-12599410)
 * No, this is not doable with basic woocommerce attributes and variations because
   I am looking for conditional logic not a product page full of options that the
   customer may not need. Please check the links I attached.
 * Thank you
 *  Plugin Support [EtienneP a11n](https://wordpress.org/support/users/etiennep/)
 * (@etiennep)
 * [6 years, 2 months ago](https://wordpress.org/support/topic/variations-conditional-logic/#post-12654215)
 * Hi [@bynejc](https://wordpress.org/support/users/bynejc/)
 * We do have the [Composite Products](https://woocommerce.com/products/composite-products/)
   extension that will get you close to what you need.
 * It has conditional logic and can display options based on a customer’s previous
   choice.
 * Here is a use case that is similar to the examples you included – [https://docs.woocommerce.com/document/composite-products/composite-products-use-case-configurable-product/](https://docs.woocommerce.com/document/composite-products/composite-products-use-case-configurable-product/)
 * If you want to try it, we have a 30-day refund policy. If the product doesn’t
   work the way you need or you think another product would work better, we are 
   more than happy to provide a full refund.
    You can read more about our refund
   policy on our website here: [http://woocommerce.com/refund-policy/](http://woocommerce.com/refund-policy/)
 *  Plugin Support [EtienneP a11n](https://wordpress.org/support/users/etiennep/)
 * (@etiennep)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/variations-conditional-logic/#post-12681440)
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved–
   if you have any further questions, you can start a new thread.

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

The topic ‘Variations conditional logic’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [buttons](https://wordpress.org/support/topic-tag/buttons/)
 * [conditional logic](https://wordpress.org/support/topic-tag/conditional-logic/)
 * [quantity](https://wordpress.org/support/topic-tag/quantity/)

 * 4 replies
 * 3 participants
 * Last reply from: [EtienneP a11n](https://wordpress.org/support/users/etiennep/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/variations-conditional-logic/#post-12681440)
 * Status: resolved