Show weight in checkout basket

Hi. I am looking for a way to show the total weight of all items in a customers basket.
I can’t seem to find how I do this.

I need to activate this for international shipping options as a customer can only select a certain maximum weight.

Thanks for any help

You can definitely show the total weight of all items in the customer’s basket, it just takes a small Liquid snippet added to your cart template.

Here’s how you can do it:

  1. Go to Online Store → Themes → Edit Code.

  2. Open your cart.liquid or main-cart-items.liquid file (depending on your theme).

  3. Inside the cart summary area (usually near where the total price is shown), add this line:

    <p>Total weight: {{ cart.total_weight | weight_with_unit }}</p>
    
    

    That will display the combined weight of all cart items automatically, based on the weight values set in your product variants.

If you need it specifically to trigger or limit certain international shipping options, you can use that same variable (cart.total_weight) in your shipping conditions or scripts, or via an app that supports weight-based logic.

If handling codes and all feels too technical, i could come in for you, if needed.

Hi

I’m in the main-cart-items-liquid and this is the code. Where would I enter the new changes

{{ ‘component-cart.css’ | asset_url | stylesheet_tag }}

{{ ‘component-cart-items.css’ | asset_url | stylesheet_tag }}

{{ ‘component-totals.css’ | asset_url | stylesheet_tag }}

{{ ‘component-price.css’ | asset_url | stylesheet_tag }}

{{ ‘component-discounts.css’ | asset_url | stylesheet_tag }}

{{ ‘quantity-popover.css’ | asset_url | stylesheet_tag }}

{%- style -%}

.section-{{ section.id }}-padding {

padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;

padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;

}

@media screen and (min-width: 750px) {

.section-{{ section.id }}-padding {

padding-top: {{ section.settings.padding_top }}px;

padding-bottom: {{ section.settings.padding_bottom }}px;

}

}

{%- endstyle -%}

{%- unless settings.cart_type == ‘drawer’ -%}

{%- endunless -%}

{{ 'sections.cart.title' | t }}

{{- ‘general.continue_shopping’ | t -}}

{{ 'sections.cart.empty' | t }}

{{ ‘general.continue_shopping’ | t }}

{%- if shop.customer_accounts_enabled and customer == null -%}

{{ 'sections.cart.login.title' | t }}

{{ ‘sections.cart.login.paragraph_html’ | t: link: routes.account_login_url }}

{%- endif -%}

{%- if cart != empty -%}

{{ ‘sections.cart.title’ | t }}

<th

class=“cart-items__heading–wide cart-items__heading–quantity small-hide caption-with-letter-spacing”

colspan=“1”

scope=“col”

>

{{ ‘sections.cart.headings.quantity’ | t }}

{%- for item in cart.items -%}

{%- liquid

assign has_qty_rules = false

if item.variant.quantity_rule.increment > 1 or item.variant.quantity_rule.min > 1 or item.variant.quantity_rule.max != null

assign has_qty_rules = true

endif

assign has_vol_pricing = false

if item.variant.quantity_price_breaks.size > 0

assign has_vol_pricing = true

endif

                -%}

{%- endfor -%}

{{ ‘sections.cart.headings.product’ | t }}

{{ ‘sections.cart.headings.total’ | t }}

{{ ‘sections.cart.headings.total’ | t }}

{% if item.image %}

{% comment %} Leave empty space due to a:empty CSS display: none rule {% endcomment %}

<img

src=“{{ item.image | image_url: width: 300 }}”

class=“cart-item__image”

alt=“{{ item.image.alt | escape }}”

loading=“lazy”

width=“150”

height=“{{ 150 | divided_by: item.image.aspect_ratio | ceil }}”

>

{% endif %}

{%- if settings.show_vendor -%}

{{ item.product.vendor }}

{%- endif -%}

{{ item.product.title | escape }}

{%- if item.original_price != item.final_price -%}

{{ ‘products.product.price.regular_price’ | t }}

{{- item.original_price | money -}}

{{ ‘products.product.price.sale_price’ | t }}

{{ item.final_price | money }}

{%- else -%}

{{ item.original_price | money }}

{%- endif -%}

{%- if item.product.has_only_default_variant == false

or item.properties.size != 0

or item.selling_plan_allocation != null

                  -%}

{%- if item.product.has_only_default_variant == false -%}

{%- for option in item.options_with_values -%}

{{ option.name }}:
{{ option.value }}

{%- endfor -%}

{%- endif -%}

{%- for property in item.properties -%}

{%- assign property_first_char = property.first | slice: 0 -%}

{%- if property.last != blank and property_first_char != ‘_’ -%}

{{ property.first }}:

{%- if property.last contains ‘/uploads/’ -%}

{{ property.last | split: ‘/’ | last }}

{%- else -%}

{{ property.last }}

{%- endif -%}

{%- endif -%}

{%- endfor -%}

{{ item.selling_plan_allocation.selling_plan.name }}

{%- endif -%}

    {%- for discount in item.line_level_discount_allocations -%}

  • {%- render ‘icon-discount’ -%}

    {{ discount.discount_application.title }}

  • {%- endfor -%}

{%- render ‘loading-spinner’ -%}

{%- if item.original_line_price != item.final_line_price -%}

{{ ‘products.product.price.regular_price’ | t }}

{{ item.original_line_price | money }}

{{ ‘products.product.price.sale_price’ | t }}

{{ item.final_line_price | money }}

{%- else -%}

{{ item.original_line_price | money }}

{%- endif -%}

{%- if item.variant.available and item.unit_price_measurement -%}

{{ ‘products.product.price.unit_price’ | t }}

{{ item.unit_price | money }}

/

<span class=“visually-hidden”

> {{ ‘accessibility.unit_price_separator’ | t }} </span

>

{%- if item.unit_price_measurement.reference_value != 1 -%}

{{- item.unit_price_measurement.reference_value -}}

{%- endif -%}

{{ item.unit_price_measurement.reference_unit }}

{%- endif -%}

{{ ‘products.product.quantity.label’ | t }}

{%- if has_qty_rules or has_vol_pricing -%}

<button

type=“button”

aria-expanded=“false”

class=“quantity-popover__info-button quantity-popover__info-button–icon-only button button–tertiary small-hide no-js-hidden”

>

{% render ‘icon-info’ %}

{%- endif -%}

{{- ‘products.product.quantity.decrease’ | t: product: item.product.title | escape -}}

{% render ‘icon-minus’ %}

<input

class=“quantity__input”

data-quantity-variant-id=“{{ item.variant.id }}”

type=“number”

name=“updates

value=“{{ item.quantity }}”

{% # theme-check-disable %}

data-cart-quantity=“{{ cart | item_count_for_variant: item.variant.id }}”

min=“{{ item.variant.quantity_rule.min }}”

{% if item.variant.quantity_rule.max != null %}

max=“{{ item.variant.quantity_rule.max }}”

{% endif %}

step=“{{ item.variant.quantity_rule.increment }}”

{% # theme-check-enable %}

aria-label=“{{ ‘products.product.quantity.input_label’ | t: product: item.product.title | escape }}”

id=“Quantity-{{ item.index | plus: 1 }}”

data-index=“{{ item.index | plus: 1 }}”

>

{{- ‘products.product.quantity.increase’ | t: product: item.product.title | escape -}}

{% render ‘icon-plus’ %}

<cart-remove-button

id=“Remove-{{ item.index | plus: 1 }}”

data-index=“{{ item.index | plus: 1 }}”

>

<a

href=“{{ item.url_to_remove }}”

class=“button button–tertiary”

aria-label=“{{ ‘sections.cart.remove_title’ | t: title: item.title }}”

>

{% render ‘icon-remove’ %}

{%- if has_qty_rules or has_vol_pricing -%}

<button

type=“button”

class=“quantity-popover__info-button quantity-popover__info-button–icon-with-label button button–tertiary medium-hide large-up-hide”

aria-expanded=“false”

>

{% render ‘icon-info’ %}

{%- if has_vol_pricing -%}

{{ ‘products.product.volume_pricing.note’ | t }}

{%- elsif has_qty_rules -%}

{{ ‘products.product.quantity.note’ | t }}

{%- endif -%}

{%- endif -%}

{%- if has_vol_pricing or has_qty_rules -%}

<div

class=“cart-items__info global-settings-popup quantity-popover__info”

tabindex=“-1”

hidden

>

{%- if has_qty_rules == false -%}

{{- ‘products.product.volume_pricing.title’ | t -}}

{%- endif -%}

{%- if item.variant.quantity_rule.increment > 1 -%}

{{-

‘products.product.quantity.multiples_of’

                                | t: quantity: item.variant.quantity_rule.increment

                              -}}

{%- endif -%}

{%- if item.variant.quantity_rule.min > 1 -%}

{{-

‘products.product.quantity.minimum_of’

                                | t: quantity: item.variant.quantity_rule.min

                              -}}

{%- endif -%}

{%- if item.variant.quantity_rule.max != null -%}

{{-

‘products.product.quantity.maximum_of’

                                | t: quantity: item.variant.quantity_rule.max

                              -}}

{%- endif -%}

<button

class=“button-close button button–tertiary medium-hide large-up-hide”

type=“button”

aria-label=“{{ ‘accessibility.close’ | t }}”

>

{%- render ‘icon-close’ -%}

{%- if item.variant.quantity_price_breaks.size > 0 -%}

  • {{ item.variant.quantity_rule.min }}+

    {%- assign price = item.variant.price | money_with_currency -%}

    {{ ‘sections.quick_order_list.each’ | t: money: price }}

  • {%- for price_break in item.variant.quantity_price_breaks -%}

  • {{- price_break.minimum_quantity -}}

    +</span

    >

    {%- assign price = price_break.price | money_with_currency -%}

    {{ ‘sections.quick_order_list.each’ | t: money: price }}

  • {%- endfor -%}

{%- endif -%}

{%- endif -%}

<svg

aria-hidden=“true”

focusable=“false”

class=“icon icon-error”

viewBox=“0 0 13 13”

>

{%- render ‘loading-spinner’ -%}

{%- if item.original_line_price != item.final_line_price -%}

{{ ‘products.product.price.regular_price’ | t }}

{{ item.original_line_price | money }}

{{ ‘products.product.price.sale_price’ | t }}

{{ item.final_line_price | money }}

{%- else -%}

{{ item.original_line_price | money }}

{%- endif -%}

{%- if item.variant.available and item.unit_price_measurement -%}

{{ ‘products.product.price.unit_price’ | t }}

{{ item.unit_price | money }}

/

<span class=“visually-hidden”

> {{ ‘accessibility.unit_price_separator’ | t }} </span

>

{%- if item.unit_price_measurement.reference_value != 1 -%}

{{- item.unit_price_measurement.reference_value -}}

{%- endif -%}

{{ item.unit_price_measurement.reference_unit }}

{%- endif -%}

{%- endif -%}

<p

class=“visually-hidden”

id=“shopping-cart-line-item-status”

aria-live=“polite”

aria-hidden=“true”

role=“status”

>

{{ ‘accessibility.loading’ | t }}

{% schema %}

{

“name”: “t:sections.main-cart-items.name”,

“settings”: [

{

“type”: “color_scheme”,

“id”: “color_scheme”,

“label”: “t:sections.all.colors.label”,

“default”: “background-1”

},

{

“type”: “header”,

“content”: “t:sections.all.padding.section_padding_heading”

},

{

“type”: “range”,

“id”: “padding_top”,

“min”: 0,

“max”: 100,

“step”: 4,

“unit”: “px”,

“label”: “t:sections.all.padding.padding_top”,

“default”: 36

},

{

“type”: “range”,

“id”: “padding_bottom”,

“min”: 0,

“max”: 100,

“step”: 4,

“unit”: “px”,

“label”: “t:sections.all.padding.padding_bottom”,

“default”: 36

}

]

}

{% endschema %}

I can’t access the actual code this way, do you mind if i come in

To be clear the cart is not the same as the checkout.
Arbitrary customizations to the cart will NOT carry through to checkout.

If you need to show item weights in checkout use line-item-properties on the individual items.
But to show total weight as it’s own element is trickier and can generally require a shopify Plus plan.

Further make the effort to use a forums formatting tools and preview.
Don’t post giant walls of code it just creates overcomplication and confusion and disrespects the time of the people your seeking aid from.
Use the code format or wrap it in a ‘Hide details’ in the options button.