20th Jul '24
/
4 comments

Condition based on WooCommerce Product Attributes in Bricks

A user asks:

showing element when woocommerce attribute selected

I need to show specific video if woocommerce attribute is selected. i have attribute difficulty and there very-easy, easy, moderate, hard and want to show each video on each difficulty level.

WooCommerce Product Attributes are taxonomies and hence it is possible to conditionally output any element based on the value of a product attribute just like we can check against any taxonomy term in Bricks.

Apply this dynamic data condition:

where color is the attribute name and Red is what you want to check for.

:plain filter ensures that hyperlinks are not included in the output.

Any element for which this condition is applied will be output if the condition is met. Ex. when viewing the following single product page:

Get access to all 626 Bricks code tutorials with BricksLabs Pro

4 comments

  • Dale Donnolly

    Hi Sridhar, I cannot seem to get this working for Variable Products. Would variable products work any different?

  • Michał Czajka

    i dont know what am i doing wrong, but if i have easy, medium, hard on my product it shows all of them, not selected.

    • A

      Need to log into your site, understand the setup to troubleshoot/further advise. But that will be paid consult.

      You may want to contact Bricks support instead :)

  • Michał Czajka

    you are the best :)

Leave your comment

 

Related Tutorials..

Create A Customizable AJAX Add To Cart Button In Bricks Builder

Create A Customizable AJAX Add To Cart Button In Bricks Builder

In Bricks, you can simply create an Add To Cart button from a dynamic data / function {woo_add_to_cart}. This button supports AJAX as well if…
[WooCommerce] Product Category Image Background in Bricks

[WooCommerce] Product Category Image Background in Bricks

How to set up the product category thumbnail image as the background of a Section.
Categories:
Pro
How to Redirect WordPress Search to WooCommerce Shop Filter by Product Title or SKU

How to Redirect WordPress Search to WooCommerce Shop Filter by Product Title or SKU

Learn how to redirect users to the Shop page with filtered results if the searched term matches a WC product title or SKU. And, if…
Categories:
Pro
How to Add Support for Variable Products in Bricks WooCommerce Filters

How to Add Support for Variable Products in Bricks WooCommerce Filters

Filtering for In Stock or Out of Stock WooCommerce products using Bricks' filters currently only works at the product level and not variation level. This…
Categories:
Pro
Product Attribute based Related Products Bricks Query Loop

Product Attribute based Related Products Bricks Query Loop

How to output products related by value of attribute(s) for the current product on single WooCommerce product pages.
Categories:
Pro
Related FAQs on Product pages Based on Product Category Taxonomy in Bricks

Related FAQs on Product pages Based on Product Category Taxonomy in Bricks

On product pages, we show all the FAQs associated with the current WooCommerce product's product categories.
Categories:
Pro
[WooCommerce] Sale price dates in Bricks

[WooCommerce] Sale price dates in Bricks

Outputting start and end sale price dates (if set) for WooCommerce products.
Categories: