Add a Total Weight Field to the Order-Summary page.

Laavanya
Excursionist
19 1 3

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

 

 

Replies 8 (8)

FreshNarrative
Shopify Partner
133 19 27

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

Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.
Email: hello@freshnarrative.io
Cocoa Beach, Florida

Monday - Friday | 9 AM — 5 PM EST
Laavanya
Excursionist
19 1 3

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.

 

FreshNarrative
Shopify Partner
133 19 27

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

Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.
Email: hello@freshnarrative.io
Cocoa Beach, Florida

Monday - Friday | 9 AM — 5 PM EST
Laavanya
Excursionist
19 1 3

@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.

Laavanya
Excursionist
19 1 3

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?

AdditionalScript.PNG

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)

 

FreshNarrative
Shopify Partner
133 19 27

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. 

Hello_World.JPG

 

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>

 

Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.
Email: hello@freshnarrative.io
Cocoa Beach, Florida

Monday - Friday | 9 AM — 5 PM EST
Laavanya
Excursionist
19 1 3

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)

CheckoutPage.PNG

 

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

FreshNarrative
Shopify Partner
133 19 27

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

 

Let's get Shopify figured out together. Get live USA-based customer service for your current or upcoming web project.
Email: hello@freshnarrative.io
Cocoa Beach, Florida

Monday - Friday | 9 AM — 5 PM EST