Liquid, JavaScript, themes, sales channels
Hey Guys,
I am on Shopify's basic plan. Does anyone know if it's possible to add a CartWeight Field to the order summary page?
Regards,
Laavanya
Hi Laavanya,
Yes, you can achieve this with some custom code using the variant object.
Let me know if you need some help!
Thanks,
Kyle
Hey @FreshNarrative. Thanks for getting back.
I do dabble in code my self, but what files would I have to tinker with to make this change. I do not have access to the checkout page and I see no liquid file to handle the order summary.
Please do let me know, If you do know how to achieve this.
Hi Laavanya,
You're right — unless you have Shopify Plus there is no way to access the Checkout page. You can however access the Cart page and Order Summary Page.
To add weight's to the cart you'd want to locate your "cart.liquid" file and take advantage of the cart.total_weight object
To add the weight to the order summary page you'd want to add a custom script to the order summary page (this is found in your Shopify admin: /admin/settings/checkout ) From there you'll want to take advantage of the line_item object.
Let me know if that helps!
Kyle
@FreshNarrative (Kyle) ...Thanks for that. It definitely does give me some direction. Going to muck around and see how I go. Thank you so much for all the help so far. Really appreciate it.
Hello Kyle,
So, I gave https://help.shopify.com/en/manual/orders/status-tracking/customize-order-status/order-status-javasc... a read and tried adding the script, but I see nothing happening. I am starting to wonder if I need the Plus Plan for this too?
Is that how you do it? Also, would the script be injected in the source file when I hit a view source on the check out page? (I tried looking for it)
Hi Laavanya,
You don't need access to Shopify Plus to add scripts to the order status page. The script below will log "Hello World" into the console.
Try this script to get you started:
<script>
Shopify.Checkout.OrderStatus.addContentBox(
{% for line in checkout.line_items %}
{% if forloop.last == true %}
'<div><p>{{line.variant.sku}} — {{line.variant.weight}} Grams</p></div>'
{% else %}
'<div><p>{{line.variant.sku}} — {{line.variant.weight}} Grams</p></div>',
{% endif %}
{% endfor %}
)
</script>
Aaahhhh, I see it now. From your screenshot, it looks like this script has fired after you have completed your order i.e paid for it?
And I am expecting it to fire prior to the payment i.e on the checkout page. (see attached image)
If you see the order summary section on the right, you see that customer has ordered 15 units of a 1 kg Kidney bean packet, and some somewhere here, they'd like to see the total weight of their purchases.
I'll go through and complete an order and see what happens. though...
Thanks, so much Kyle.
-Laavanya
Hi Laavanya,
Unfortunately, it's not possible to modify the "checkout" page. Maybe you could add the weight to the cart before the checkout page and then again on the order summary page? Just a thought.
Or add a title to the shipping method name. For example, 5kg - $13.03.
If you have orders in the past you can view old order status pages rather than creating another order to see any changes you make to the scripts!
Let me know how it goes.
Kyle
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024