Insert Product Weight into Product Description

Is it possible to insert the value of a products weight into the products description using code? This way the weight of the product is visible information to the customer before they purchase and it would make things a lot quicker as there would be no need to manually include the weight in each and every products description, as this would be done automatically.

The theme being used is Debut.

1 Like

Hey @somersetfoodie ,

You need to change the product page template liquid file.

You can use the following code to display product weight.

Weight: {% for variant in product.variants %}{{variant.weight | weight_with_unit }}{% endfor %}

Hope this will work.

Thanks!

Thanks for the quick response! Where in the code structure should I use the code you provided? This is how the product.liquid code looks right now:

{% comment %}
  The contents of the product.liquid template can be found in /sections/product-template.liquid
{% endcomment %}

{% section 'product-template' %}
{% section 'product-recommendations' %}

{% if collection %}
  
    
      {% include 'icon-arrow-left' %}
      {{ 'products.product.back_to_collection' | t: title: collection.title }}
    
  

{% endif %}

{% assign current_variant = product.selected_or_first_available_variant %}

Hey @somersetfoodie ,

Go to Sections/product-template.liquid file. You will get a description code there just paste given code there and see where it appears.

Move that code in your desired place.

Thanks!

1 Like

Thanks, this has worked! It is currently displaying the weight in lbs when I would like it display kg. Is it possible to change which unit of weight the code displays?

Hey @somersetfoodie ,

Please edit the product and check the setting of the product weight in the admin. It must be in KG.

Because if you see the code, it is dynamic. It will automatically take weight measurements for the product.

So please check in the admin.

Thanks!

Hi

I follow the instruction and although I have gr. as weight metric for the products in the Admin, the weight is displayed as kg. in the product page.

Do you know how I can show gr. instead of kg in the product page?

Thanks

@dmwwebartisan

Dear Sir

is there is away to show weight when variant chosen

not display all variants weight as the photo

Hi, I’m trying to do the same, but I need the weight to change according to the variant selected on the product page (I have between 3 and 12 variants on each page.) Is there a way to do this?

Thanks!!

1 Like