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
(@bynejc)
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
Hi @bynejc
We do have the 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/
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/
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.