Skip to main content
Contributor IV
April 5, 2022
Solved

How to Change Subject line depending on how many products in card?

  • April 5, 2022
  • 7 replies
  • 454 views

if the item count is one, subject line should be: “You have an item in you shopping cart” 

if item count is more then one, subject line should be: “You have an items in you shopping cart” 

 

How do i did this?

Thanks! 

Alice 

    This topic has been closed for replies.
    Best answer by Mailbox Manny

    I believe it would be like the first example you gave.  What happens you test it out with Preview? 

    7 replies

    stephen.trumble
    Klaviyo Alum
    April 6, 2022

    Hey @AliceC 

    Thank you so much for asking such a great question! Happy to help.

    You can use event variables in your subject line to customize how your customers are seeing it! This is unique to each ecommerce platform and each account as to the event information being used it’s hard to tell you exactly what to use for syntax but an example for BigCommerce would be: {{ event.extra.line_items.0.quantity }} . The article I included goes over how to use and find the correct event variables you are looking for to use in your subject lines!

    Hope this helps!

    -Stephen
    AliceCAuthor
    Contributor IV
    April 20, 2022

    Thanks @stephen.trumble ! 

    We use Shopify. Could you help me string the subject line together with the event variable in an IF statement?  

    if the item count is one, subject line should be: “You have an item in you shopping cart” 

    if item count is more then one, subject line should be: “You have an items in you shopping cart” 

    AliceCAuthor
    Contributor IV
    April 20, 2022

    For instance would it be this…?

     

    {{ % if event.extra.line_items.0.quantity = 1 %}} You have an item in you shopping cart {% else %} You have items in you shopping cart {% endif %}

     

    OR 

     

    {% if items.quantity|floatformat:0 < 2 %} You have an item in you rshopping cart {% else %}You have items in your shopping cart {% endif %}

     

    Sorry i’m only a novice. Any help would be greatly appreciated! 

    Mailbox Manny
    Partner - Silver
    Partner - Silver
    April 28, 2022

    I believe it would be like the first example you gave.  What happens you test it out with Preview? 

    Subscribe. Segment. Send. Repeat.
    Problem Solver II
    May 2, 2022

    Waiting for preview results

    stephen.trumble
    Klaviyo Alum
    May 2, 2022

    @Mailbox Manny is most likely correct, the first example you you shared {{ % if event.extra.line_items.0.quantity = 1 %}} You have an item in you shopping cart {% else %} You have items in you shopping cart {% endif %}. Definitely preview the email to make sure it is correct. 

    Thank you all for working together to find a solution and for being part of the Klaviyo Community!

    -Stephen
    AliceCAuthor
    Contributor IV
    May 3, 2022

    @ayyub_here @Mailbox Manny 

    No - “{{ % if event.extra.line_items.0.quantity = 1 %}} You have an item in you shopping cart {% else %} You have items in you shopping cart {% endif %}”  does not work hence i’m asking the question. 

    Any one have any ideas??