NO BUG: Condition does not work with Loop

Browser: Chrome Version 126.0.6478.127
OS: Windows

I use this plugin: WooCommerce Product Bundles

In the database I have the meta key: _wc_pb_bundle_stock_quantity (Data Structures and Storage Documentation - WooCommerce)

I have the following setup:
image

Condition on “Div (sold out)” works.
image

Condition on “Div (new)” works too.
image

Condition on “Div (loop)” dont work. Although it is identical to the Condition on “Div (new)”.
image

Everything works in the database without any problems. The values are all set correctly.

Hi,
Thanks so much for your report!

Can you provide a little more context? What is the purpose of the loop? Display other bundles? If so, you should use a meta query instead of the condition.

Best regards,
timmse

I create badgets via an ACF custom taxonomy. For example: “Popular”, “Hot” etc.

These taxonomies are displayed in a loop on the product card. If the product is sold out (_wc_pb_bundle_stock_quantity <= 0), then I no longer need the badges (the complete div) and would like to show another “Sold out” badge instead.

If you need more information, please let me know.

Ok. If you wrap the loop with a div and apply the condition there, it should work, right?
If the condition is directly on the loop, the dd tag refers to the loop item (the badges) - not to the product itself.

Yes, they are right. If I wrap the loop in another div and apply the condition to it, then it works. But should that be the case?
image

Yes :slight_smile: As I already said:

Ok, thanks for the quick clarification. Even if I didn’t quite understand it.

I do understand that the condition refers to something else. But I don’t understand why - it makes it look like a UX error. But you know what you’re doing :slight_smile: