Hello, I am trying to use the “Conditionals” feature to hide and display certain layout elements on a specific product, but I can’t seem to find the right option. I am using a ‘WC Single’ layout, but there doesn’t seem to be an option to render an element based on a specific product—I can render based on a specific post, but not a specific product. Am I missing the correct conditional criterium or is it missing?
Hey, @bobbybosler! Thanks for writing in…you are correct, it seems the “Product (Specific)” conditions are not showing up at the moment. I will be looking into this here to see about hopefully getting that in ASAP. In the meantime, if you’re running Pro v4.1.0, you can probably get pretty close to what you need using our Element Condition Expressions in a couple creative ways…
Firstly, if your Product names are all unique and don’t really have any crossover / shared verbiage, you could use the String expression to perform an operation like this:
This will look for the presence of whatever you put into the left input in the right input, which in this case happens to be using our {{dc:woocommerce:product_title}}
Dynamic Content string, which is just pulling through the Product’s Title. Keep in mind that your string much me an exact match: all capitalization, punctuation, and whitespace will be checked. Now the in
statement will look for the presence of that substring anywhere in the Title, but if you want to look for just a strict match, you could use is
instead.
Another option you could try is something like this with the Number expression:
Here we’re comparing the {{dc:woocommerce:product_id}}
Dynamic Content string (which just gives us the numeric ID of the Product) using the ==
operator, which looks for a “strict equals” with the value in the final input. So for this example, this condition would return true
if the product ID was 53
. You could include as many of these statements as you need to reference specific products, all you need to do is go locate the Product ID from the WordPress admin (the easiest way to do this is go to your Products index in the WordPress admin and hover over the title of each one and in the URL preview in your browser, you should see a number in the string, which is the Product’s ID).
We will definitely work on getting in the “Product (Specific)” conditions just like our other post types, but for now these workarounds can at least get you to the same result. Hopefully this helps to point you in the right direction…cheers!
As a quick follow up on this, we’ve patched this issue already and it should go out in the next release:
So you can wait for that if you’d prefer, or utilize the methods I’ve outlined above. We apologize again for the inconvenience and thank you for your patience, @bobbybosler! Have a great day.
Thanks so much for the very helpful reply! I implemented the Number method with my “Product ID”, as you suggested, and it worked like a charm. Those new condition types are AWESOME! I’m sensing some more tutorial videos on the way from Kory!
Hey, @bobbybosler! So glad that helped you out for the time being, and our apologies again for the missing specific Product filters…turned out to be a typo on our end. As mentioned, that will be patched soon, and I’m glad you were able to get something working for the time being. There may or may not be some more videos coming your way soon. Have a great day!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.