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 610 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..

Fix for “Your theme (Bricks Child Theme) contains outdated copies of some WooCommerce template files.”

Fix for “Your theme (Bricks Child Theme) contains outdated copies of some WooCommerce template files.”

Updated on 18 Feb 2023 Users of current (at the time of writing this) Bricks stable version of 1.6.2 and WooCommerce 7.4.0 will likely see…
Categories:
[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:
Is WooCommerce Cart Empty Condition in Bricks

Is WooCommerce Cart Empty Condition in Bricks

Updated on 5 Nov 2024 Looking to conditionally render an element depending on whether the user's cart is empty or not when using WooCommerce? Add…
Pro
Top-Level Product Categories in Bricks

Top-Level Product Categories in Bricks

How to show top-level WooCommerce product categories in Bricks using a query loop.
Categories:
Pro
Similarly Priced WooCommerce Products Bricks Query Loop

Similarly Priced WooCommerce Products Bricks Query Loop

How to show products priced within a percentage of the current single product's price.
Categories:
Pro
Stock Quantity Block for WP Grid Builder

Stock Quantity Block for WP Grid Builder

In the unofficial WP Grid Builder Facebook group a user asked: Is it possible to show stock quantity on the card? I can't find it…
Categories: