Adding shopping cart attributes in order confirmation e-mails

fyt_Kitchen_Del
New Member
2 0 1

Hi there!

I'm having issues adding unique order attributes to the order confirmation e-mails that my customers as well as my employees receive.  Essentially, we run a food delivery business and need to know the delivery method the customer would like.  We offer 3 options: 1) Ring Buzzer 2) Leave with doorman 3) Leave at service entrance.  We have implemented these attributes as check-box options within our shopping cart and they function well but we have to check each order in our Admin to see what the customer has selected.   It would be ideal if this was included in our order confirmation notification e-mail.  

We also implemented a text-box 'notes' attribute within our shopping cart which enables the customer to enter additional notes regarding their order. Currently, our notification e-mails are coded to include 'notes' (and it functions well) but I am unable to figure out the best code for including the delivery method attributes within the order confirmation notification e-mails.

_____

Here are the codes that are used for each attribute in our cart.liquid file:

<br><u>Delivery Method</u>

<p>
<input type="checkbox" name="attributes[doorman]" id="doorman" value="yes" {% if cart.attributes.doorman %} checked="checked"{% endif %} />
<label for="doorman">Please leave with my doorman</label>
</p> 

 
<p>
<input type="checkbox" name="attributes[buzzer]" id="buzzer" value="yes" {% if cart.attributes.buzzer %} checked="checked"{% endif %} />
<label for="buzzer">Please ring the buzzer</label>
</p> 


<p>
<input type="checkbox" name="attributes[serviceentrance]" id="serviceentrance" value="yes" {% if cart.attributes.serviceentrance %} checked="checked"{% endif %} />
<label for="serviceentrance">Please use service entrance</label>
</p> 


<p>
<label for="note">Additional notes:</label><br/>
<textarea name="note" id="note" rows="3" cols="60">{{cart.note}}</textarea>
</p>   
</form>

______

Here is the code used for the 'notes' attribute' in our order confirmation notification e-mail:

{% for line in line_items %}{{ line.quantity }}x {{line.title }} for {{ line.price | money }} each
{% for note in line.properties %}

{{note.first}} : {{note.last}} {% endfor %}

{% endfor %}

_____________________

Is there anyone out there who knows what code would be best to use for implementing order attributes into the order confirmation e-mail notifications? I'm unsure if it should be: 

OPTION A:      

{% if cart.attributes.doorman %} "Doorman: YES"  {% endif %}

OPTION B:    

 {% for cart.attributes.doorman %} "Doorman: YES" {% endfor %}

OR 

OPTION C:  Something else?

 

Please help :(  Thank you for reading!

0 Likes
Kylea1
Shopify Staff (Retired)
Shopify Staff (Retired)
130 0 19

Hey there!

You should be able to use:

{% for attribute in attributes %}
{{ attribute | first | replace: '-', ' ' | replace: '_', ' ' | capitalize }} : {{ attribute | last }}
{% endfor %}

Take a look at this article for more information on cart attributes: http://docs.shopify.com/manual/configuration/store-customization/ask-customer-for-more-information

Cheers, 
Kylea

0 Likes
fyt_Kitchen_Del
New Member
2 0 1

Thanks so much for your help! I read that article a couple times before posting my question but I couldn't see the answer right in front of me.  I will implement the suggested code. Fingers crossed it will work.

 

Thanks again!

LRoel
New Member
3 0 0

Hello!

I would like to know if you can help me with our store. 

We currently have the below notes on Cart 

LRoel_0-1612415269484.png

and below is the code 

LRoel_1-1612415297267.png

 

I am trying to put the notes from POnumber and Event date but I do not know what attribute should I should on the order confirmation to call out the two fields?

 

 

Thank you!

 

 

 

0 Likes