Conditions and Loopers based on WooCommerce Attributes?

Hi!

I have WooCommerce products that have various attributes assigned. I am struggling to do two things:

  1. Set a condition: If a product has certain product attribute, show/hide an element.

  2. Create a query string that outputs products that share a same attribute value as the current product. For example, if the current product has the “Sunglasses-type” attribute value set to “Oval”, I’d like to display a looper with “Oval” sunglasses.

is the above possible? If yes, I would greatly appreciate if you could point me in the right direction. :slight_smile:

Thank you!

Hi Mihso,

Thanks for reaching out!

Would you mind sharing your admin credentials so that we can check your setup properly? To do that, please give us the following information in a Secure Note.

  • WordPress Login URL
  • Admin level username and password

You can find the Secure Note button at the bottom of your posts.

Cheers!

Hi! sure, I have updated the secure note.

I have also provided you with an example product on my staging website.

On the example product, one of its WooCommerce attributes is “Dostupnost: rezervirano”, which means “Availability: reserved”. I’d like to use conditions to display a badge if this attribute is assigned to the product.

On this (unfinished) product single layout, by visiting the Ray-Ban sunglasses from the example above, you can see my Query string that lists all sunglasses that have a common value inside an ACF field (Same product base model).

Similarly, I want to crate another list of sunglasses on this layout, that would list a few other sunglasses that share a same Attribute value. In this case, the attribute would be “Oblik” which means “Shape”. The example product has a value of “Okrugle” for this attribute, which means “Round shape”.

In essence, I am trying to construct a query string that would list all sunglasses that share the same “Oblik (Shape)” attribute as the product the visitor is on. Basically this is the “Similar products” list.

Thank you!

Hello Misho,

Thanks for writing in!

Regretfully we do not have a dynamic content that you can use to get the attributes of a product. If you are trying to display similar products, please use the default “Upsells” dynamic element instead.

There is also the Related products and the Cross Sells that you may be able to use to display in your single product layouts.

Best Regards.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.