Jump to content

How to remove decimal on product weight


Recommended Posts

The default PrestaShop v1.6.1.7 theme doesn't display product weights in the shopping cart. Can you post the line of code from shopping-cart-product-line.tpl that displays the product weight? It should contain $product.weight or something like that.

Link to comment
Share on other sites

Thanks for the link. Unfortunately, I don't know the code that is currently formatting the weight, so it's hard to suggest changing it. If it is being formatted to 8 decimal places, then I'd suggest removing the formatting code, which could be something like |number_format:8.

Link to comment
Share on other sites

Thankyou rocky for your support.

 

And thankyou Rho_bur, your amazing |string_format:"%.2f" works well in my cart.

Its simple, i just change the line:

 

<td class="cart_weight">{if $product.weight}{$product.weight|escape:'htmlall':'UTF-8'} {$weightUnit}{/if}</td>

 

to

 

<td class="cart_weight">{if $product.weight}{$product.weight|string_format:"%.2f"|escape:'htmlall':'UTF-8'} {$weightUnit}{/if}</td>

 

in my shopping-cart-product-line.tpl, placed above line {if $PS_STOCK_MANAGEMENT}

 

Prestashop 1.6.1.7

Edited by r_r4f (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...