Hey @Jessica eCommerce Badassery, I think the key here is to make sure you’re using single quotes. I just tried something like this myself, and it seems to be working!
{% if ‘Spa Day Detox (ACV Shampoo Bar)’ in item.product.title %} ADD YOUR CONTENT HERE {% endif %}
And, this is doing a contains, vs. an exact match. To do an exact match you would want to do
{% if ‘Spa Day Detox (ACV Shampoo Bar)’ == item.product.title %} ADD YOUR CONTENT HERE {% endif %}
I’m curious - what are you trying to do with this conditional logic?
@cadence it’s working for you? WTH, lol.
I have a pretty long if statement with multiple OR conditions and as soon as I add a product with () in the title it errors out the entire statement, changes my & to html and gives me a syntax error.
I didn’t check what would happen if I did it on it’s own. But I will just to confirm. I tried with both single quotes and double quotes and both behave the same way.
Oh… interesting on the contains, because in theory then I could just not include the portion of the product name that doesn’t have the (). I can test with another product to confirm.
I’m creating a subscription invite email that has a repeating block to show items customers have purchased in their last order. There are certain items that don’t have a subscription option so I want to exclude them from rendering in the email.
@Jessica eCommerce Badassery, oh no! What kind of block are you using, a dynamic table? Mind sharing a screenshot and copy/pasting the django code you’re writing?
For some context, I was testing with a dynamic table block. I did run into some problems when trying to edit this in the default, non-source-code editor… It ended up getting super wonky there 😅
So I went over to the source code editor and wrote the code there instead.
@cadence I was definitely doing it in the source code and yes, a dynamic table block.
I was able to confirm that the in is contains, so I think I should be good to just remove the portion of the title that has the ()
I should have thought to create an event with the products I needed to test that theory, haha.. Thanks for your help!
@Jessica eCommerce Badassery, np! Glad you’re unblocked on this! Yeah, that’s my go-to trick with Klaviyo templates, creating events to preview the email in different states.