Liquid, JavaScript, themes, sales channels
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!
Solved! Go to the solution
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>
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>
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.
Edited to remove my question - the solution is correct and I had a small typo in my attribute name (capitalization got me.. My fault!)
Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024Digital marketers and app developers have tracked activity in apps and websites for yea...
By Ollie Mar 13, 2024February was an exciting month with Shopify Editions, informative webinars, and more! F...
By JasonH Mar 7, 2024