Solved

If MetaData contains "word" logic

  • 1 February 2023
  • 5 replies
  • 75 views

Userlevel 1
Badge +3

So we are accepting back orders from customers now (on Woo) and this comes across in Klaviyo as 

{{ event.extra.Items.0.Metadata.0.Name }} and the label says “Name: Back-ordered”

I know I am doing the below wrong but could somebody help me with the exact logic required? 

“{% if "Back-ordered" in event.extra.Items.Metadata.Name %} Text

{% endif %}

 

 

icon

Best answer by alex.hong 3 February 2023, 04:38

View original

5 replies

Userlevel 7
Badge +60

Hey @SDBradfo 

Thanks for reaching out for help with your variable syntax and writing If statements

Overall, what are you trying to accomplish by using this syntax? Are you using it in a campaign or a flow? If it’s a flow, what metric are you using for the trigger? Generally more information would be needed to determine exactly how to write the IF statement based on what you are trying to accomplish and what event variable should be used. Please let me know more details so we can dig deeper for a clear and easy to follow solution!

I’ll be on the lookout for your response! 

Userlevel 1
Badge +3

Hello thanks for the reply.

 

It is in a flow for the “new order” trigger from Woocommerce.

Basically if it contains the word “back-order” we will output some text explaining the process from our side 

Hey @SDBradfo 

Thanks for reaching out for help with your variable syntax and writing If statements

Overall, what are you trying to accomplish by using this syntax? Are you using it in a campaign or a flow? If it’s a flow, what metric are you using for the trigger? Generally more information would be needed to determine exactly how to write the IF statement based on what you are trying to accomplish and what event variable should be used. Please let me know more details so we can dig deeper for a clear and easy to follow solution!

I’ll be on the lookout for your response! 

 

Userlevel 7
Badge +58

@SDBradfo 

It may be possible to accomplish this, do you know if the status of the item (whether it is back-ordered or not) is stored as a product attribute?  If so, it may be possible to modify your client's WooCommerce integration so that these product attributes are synced into Klaviyo. 

Userlevel 1
Badge +3

@SDBradfo

It may be possible to accomplish this, do you know if the status of the item (whether it is back-ordered or not) is stored as a product attribute?  If so, it may be possible to modify your client's WooCommerce integration so that these product attributes are synced into Klaviyo. 

Yes it’s under MetaData (see image) 

 

I am thinking something like 

“{% if "Back-ordered" in event.extra.Items.Metadata.Name %} Text

{% endif %}” 

Should work?

 

Userlevel 1
Badge +3

So I can only get it to work with this

 

{% if "_alg_wc_cog_item_cost" in event.extra.Items.0.Metadata.0.Name %}
{% endif %}

but obviously it won’t always be on Line 0.

Reply