Home > Shopify Development > How to Add Weight with Unit

How to Add Weight with Unit

Sam Nguyen
Sam Updated: August 09, 2024

Share:

Drive 20-40% of your revenue with Avada
avada email marketing

Many Shopify users find it challenging to accurately display product weights with units like grams, kilograms, or pounds on their stores. This can lead to customer confusion and impact sales. In this guide, we’ll show you simple steps to add weight with units in Shopify, ensuring your product listings are clear and professional. Whether you’re new to Shopify or looking to improve your store, we’ve got you covered.

How to add weight with unit in Shopify

Weight with unit introduction

As you know about, you can use weight_with-unit filter to convert it into your store’s weight format or your weight unit that is configured on the variant. In addition, it can work well with the weight_in-unit attribute as well as weight_with_unit filter.

How to format product variant’s weight

You can easily format the variant’s weight of the product.

Input


{{ product.variants.first.weight | weight_with_unit }}

Output


24.0 kg

Take note that this unit can be overridden by being passed into filters. This is helpful in case the product variants have their own unit.

Input


{{ variant.weight | weight_with_unit: variant.weight_unit }}

Output


52.9 lb

Conclusion

After reading this post, we hope that you can understand more about weight_with_unit filter. Also, this review helps you answer well your question on how to add weight with unit in Shopify.


Sam Nguyen is the CEO and founder of Avada Commerce, an e-commerce solution provider headquartered in Singapore. He is an expert on the Shopify e-commerce platform for online stores and retail point-of-sale systems. Sam loves talking about e-commerce and he aims to help over a million online businesses grow and thrive.

Stay in the know

Get special offers on the latest news from AVADA.