Solved

Adding cart attributes to order status page

Crafty_Support
Visitor
2 0 0

Hello!

I've been trying to include a cart attribute into a customers Order Status page. I've tried it several different ways syntactically but it hasn't worked. 

The form input looks like this: 

<input id="date" type="text" name="attributes[Delivery Date]" readonly='true' required >

 

And the code for the "Additional Scripts" for added checkout customization:

 

<script>
{% for attribute in attributes %}
    {% if {{ attribute | Delivery Date }} %}
        Shopify.Checkout.OrderStatus.addContentBox(
            '<p>Your Delivery Date is: {{ attribute | Delivery Date }}</p>'
        )
    {% endif %}
{% endfor %}
</script>

 

If anyone can help with where my error might be, I would greatly appreciate it! 

Thanks in advance!

Accepted Solution (1)

Developer-G
Shopify Partner
3032 593 846

This is an accepted solution.

Try this one

 

<script>
  {% if order.attributes["Delivery Date"]  %}
    Shopify.Checkout.OrderStatus.addContentBox(
	 '<h2>Your Delivery Date is::</h2>',
      '<p style="padding-top: 8px;"><strong></strong> {{ attributes["Delivery Date"] }}</p>',
 
    )
  {% endif %}
</script>
- If helpful then please Like and Accept Solution.
- Want to modify or custom changes or bug fix on store Hire me.
- Email: guleriathakur43@gmail.com - Skype: navrocks1 ,
- Try GEMPAGES a great page builder
-Advance Search Filter

View solution in original post

Replies 4 (4)

Developer-G
Shopify Partner
3032 593 846

This is an accepted solution.

Try this one

 

<script>
  {% if order.attributes["Delivery Date"]  %}
    Shopify.Checkout.OrderStatus.addContentBox(
	 '<h2>Your Delivery Date is::</h2>',
      '<p style="padding-top: 8px;"><strong></strong> {{ attributes["Delivery Date"] }}</p>',
 
    )
  {% endif %}
</script>
- If helpful then please Like and Accept Solution.
- Want to modify or custom changes or bug fix on store Hire me.
- Email: guleriathakur43@gmail.com - Skype: navrocks1 ,
- Try GEMPAGES a great page builder
-Advance Search Filter
Crafty_Support
Visitor
2 0 0

Thank you so much!

 

All the documentation I read was pointing to the "checkout" or "cart" object. I never thought of "order"!

 

You are awesome.

robertoe135
Tourist
4 0 1

Hi @Developer-G,

 

This is not workig for me for some reason. What am I doing wrong?

buildpath
Shopify Partner
59 11 19

Edited to remove my question - the solution is correct and I had a small typo in my attribute name (capitalization got me.. My fault!)

Ecom entrepreneur since 2004 | Shopify App developer since 2021 | Shopify merchant and theme developer since 2016