Product weight is not showing the correct amount

Hey

So I have one product with only 0.5 g (weight) but all the time it shows for 1g. Every other product the weight is over 1g and it shows correct but only for this one its 0.5g but shows 1 g

I already asked my theme developer and they said that it has something to do with this code snippet a member of the shopify community changed for me. But they wont help me cause its not handle stuff like this.

Hello @YounesTimitar

Your code image is not clear but have you tried {{ variant.weight | weight_with_unit }} this code?

1 Like

Hey,

Where should I try this? I dont want to delete the current code because it was a costume code made by a developer to show the product infos at a specific point and I want to keep that.

@YounesTimitar you have to put this code where your weight code is now. Just make sure you assign a variant variable as per your theme’s name.
For eg., I gave you this code {{ variant.weight | weight_with_unit }} but your theme has currentVariant instead of variant. Thene your code is {{ currentVariant.weight | weight_with_unit }}

Still, if you are not comfortable with code editing, you can mail me at bytescoop.tech@gmail.com and I can help you with theme customization.

Thank you!

Hey, When I put this code in it shows 0 g for every product

Can you please allow me to edit your code? you can send me a store invite
on bytescoop.tech@gmail.com

Can we try it like this first please.

This is the new code:

And now it shows 0g for every product:

@YounesTimitar you have to use the current_variant variable instead of currentVariant.
I give you the currentVariant variable as an example.
But this is not the working solution. I tried it in my store also and it has the same problem.
Shopify auto rounds off the .5-gram value in their nearest number.

Hey,

Thanks for your awnser, so what should I do now I didnt really understandyou.