Conditional attribute values displayed | WordPress.org

[ad_1]

Hi @alitchfield

While WooCommerce itself doesn’t offer this out-of-the-box, there’s a plugin like the WooCommerce Variation Swatches and Photos or Variation Swatches for WooCommerce can help you with this. These plugins replace the dropdown fields on your variable products with WooCommerce Color and Image Swatches.

I hope this helps! If you have any other questions, feel free to ask.

Thanks for that. However, these will not provide text or numeric values will they?

Hello @alitchfield,

Can you please elaborate on what you mean by “text or numeric values”? Are you referring to specific product attributes, custom fields, or something else?

You can check the live demo of the WooCommerce Variation Swatches and Photos plugin from here. For this Variation Swatches for WooCommerce plugin, you can explore the description with live demos here.

[Edited to add clarity]

Sure. Let’s say there is a brochure

Let there be 3 attributes, Finished Size (1), Sheet Size (2), and Panels (3). The attributes are displayed on the product page as a list of drop down menus.

Finished Size (1) has the values DL and A4

Sheet Size (2) has the values A4 and A3

Panels (3) has the values 4, 6, and 12

Scenario 1:

If DL from (1) is selected, then from (2) A4 and A3 can be selected.

If A4 is selected, then from (3) only 6 is available

If A3 is selected, then from (3) only 12 is available

Scenario 2:

If from (1) A4 is selected, then from (2) only A3 is available

When A3 is selected, then from (3) only 4 is available

None of these are graphic images or colours. They are numeric and text values.

  • This reply was modified 7 hours, 10 minutes ago by alitchfield.

Hi there @alitchfield,

Based on the description, it looks like you would like to set up conditional logic for your product attributes.

As my colleague had earlier shared, WooCommerce’s core functionality does not support conditional logic for product attributes out of the box. In that case, you will need the help of plugins to achieve this.

One such plugin can be the Conditional Checkout Fields & Edit Checkout Fields for WooCommerce or this third-party plugin.

I hope this points you in the right direction.

Yes, that is what is needed and those two solutions do achieve conditions. However, they only work on the cart page and not the single product page (which I had noted previously as a requirement).

Halfway there 😉

Hi @alitchfield,

Thanks for clarifying. In that case, to implement this, you’ll require custom coding.

Please note that helping out with custom coding of this nature is outside the scope of support that our support staff can help out with here, although I found this thread and I think it will point you int the right direction.

I would also recommend the following:

  1. Running the exact question you’re asking, through an AI platform like ChatGPT, for recommendations.
  2. Joining our WooCommerce Slack community (it does have a developer channel where you can ask coding questions): https://woo.com/community-slack/

Hope it helps!

Thanks, it does. I will link up with the slack channel.

Hi @alitchfield

I’m glad we were able to help! I will mark this thread as resolved. Should you have further inquiries, kindly create a new topic here.

Meanwhile, if it isn’t too much to ask for – would you mind leaving us a review here?

It only takes a couple of minutes but helps us tremendously. It would mean so much to us and would go a really long way.

Thanks!

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer