[Skip to main content](#vessel-content)

#   Show weight and price per unit in checkout cart

##

- **[flexsus](/forum/user/39807-flexsus "View flexsus's Profile")**
- [![flexsus's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar39807.jpg)](/forum/user/39807-flexsus "View flexsus's Profile") Topic Author
- [ Offline](/forum/user/39807-flexsus)

Less More

- Posts: 136
- Thank you received: 7
-
-
-

9 years 2 months ago -  9 years 2 months ago [\#277023](#277023) by [flexsus](/forum/user/39807-flexsus "View flexsus's Profile")  *[Show weight and price per unit in checkout cart](/forum/27-checkout/891703-show-weight-and-price-per-unit-in-checkout-cart#277023 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.5 -- PHP version -- : 7.0.10 -- Browser(s) name and version -- : all -- Error-message(debug-mod must be tuned on) -- : none  Hi Hikashop  I'm trying to add a little more information to the customers experience when viewing the checkout cart. I have done some override to show&#95;block&#95;cart.php.  Under product name I would suggest and like that the product&#95;weight is shown. I have added the code below, but I have two problems:  1) the $this-&gt;options&#91;show&#95;product&#95;weight&#93; is not in the array and this is why I have comment it out for now. 2) the $product-&gt;product&#95;weight&#95;unit is all in 'kilo' even though the product has 'gram' as unit.  Under price I would suggest and like that the price&#95;per&#95;unit is shown.  Both information's can be found on the product detail page, from where I have looked for code inspiration.  Thanks in advanced.  Best regards, Henrik")* was created by *[flexsus](/forum/user/39807-flexsus "View flexsus's Profile")*

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.5
-- PHP version -- : 7.0.10
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : none

Hi Hikashop

I'm trying to add a little more information to the customers experience when viewing the checkout cart. I have done some override to show_block_cart.php.

Under product name I would suggest and like that the product_weight is shown. I have added the code below, but I have two problems:
Code:

//if(!empty($this-&gt;options['show_product_weight'])) { ?&gt;&lt;span id="hikashop_cart_product_weight" class="hikashop_cart_product_weight"&gt; &lt;?php echo rtrim(rtrim($product-&gt;product_weight,'0'),',.').' '.JText::_($product-&gt;product_weight_unit); ?&gt;&lt;/span&gt;&lt;?php //}

1) the $this-&gt;options[show_product_weight] is not in the array and this is why I have comment it out for now.
2) the $product-&gt;product_weight_unit is all in 'kilo' even though the product has 'gram' as unit.

Under price I would suggest and like that the price_per_unit is shown.

Both information's can be found on the product detail page, from where I have looked for code inspiration.

Thanks in advanced.

Best regards,
Henrik

[ ![checkout-card&#95;info.png](/forum/attachment/40005) ](/forum/attachment/40005 "...-card&#95;info.png")

---

.ninja { color: black; visibility: hidden; }
In case of fire:
1. git commit
2. git push
3. exit building

- [ ![checkout-card&#95;info.png](/forum/attachment/40005) ](/forum/attachment/40005 "...-card&#95;info.png") [ ](/forum/attachment/40005?download=1 "...-card&#95;info.png")

Last edit: 9 years 2 months ago by [flexsus](/forum/user/39807-flexsus "View flexsus's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0Lzg5MTcwMy1zaG93LXdlaWdodC1hbmQtcHJpY2UtcGVyLXVuaXQtaW4tY2hlY2tvdXQtY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

9 years 2 months ago [\#277029](#277029) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Show weight and price per unit in checkout cart](/forum/27-checkout/891703-show-weight-and-price-per-unit-in-checkout-cart#277029 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.5 -- PHP version -- : 7.0.10 -- Browser(s) name and version -- : all -- Error-message(debug-mod must be tuned on) -- : none  Hi Hikashop  I'm trying to add a little more information to the customers experience when viewing the checkout cart. I have done some override to show&#95;block&#95;cart.php.  Under product name I would suggest and like that the product&#95;weight is shown. I have added the code below, but I have two problems:  1) the $this-&gt;options&#91;show&#95;product&#95;weight&#93; is not in the array and this is why I have comment it out for now. 2) the $product-&gt;product&#95;weight&#95;unit is all in 'kilo' even though the product has 'gram' as unit.  Under price I would suggest and like that the price&#95;per&#95;unit is shown.  Both information's can be found on the product detail page, from where I have looked for code inspiration.  Thanks in advanced.  Best regards, Henrik")*

Hello Henrik,

The best solution will probably be to directly check what you have on your PHP variables like "$product" in your case, using functions like var_dump and then you'll fully see which information you have and what you can display.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0Lzg5MTcwMy1zaG93LXdlaWdodC1hbmQtcHJpY2UtcGVyLXVuaXQtaW4tY2hlY2tvdXQtY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[flexsus](/forum/user/39807-flexsus "View flexsus's Profile")**
- [![flexsus's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar39807.jpg)](/forum/user/39807-flexsus "View flexsus's Profile") Topic Author
- [ Offline](/forum/user/39807-flexsus)

Less More

- Posts: 136
- Thank you received: 7
-
-
-

9 years 2 months ago [\#277111](#277111) by [flexsus](/forum/user/39807-flexsus "View flexsus's Profile")  Replied by *[flexsus](/forum/user/39807-flexsus "View flexsus's Profile")* on topic *[Show weight and price per unit in checkout cart](/forum/27-checkout/891703-show-weight-and-price-per-unit-in-checkout-cart#277111 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.5 -- PHP version -- : 7.0.10 -- Browser(s) name and version -- : all -- Error-message(debug-mod must be tuned on) -- : none  Hi Hikashop  I'm trying to add a little more information to the customers experience when viewing the checkout cart. I have done some override to show&#95;block&#95;cart.php.  Under product name I would suggest and like that the product&#95;weight is shown. I have added the code below, but I have two problems:  1) the $this-&gt;options&#91;show&#95;product&#95;weight&#93; is not in the array and this is why I have comment it out for now. 2) the $product-&gt;product&#95;weight&#95;unit is all in 'kilo' even though the product has 'gram' as unit.  Under price I would suggest and like that the price&#95;per&#95;unit is shown.  Both information's can be found on the product detail page, from where I have looked for code inspiration.  Thanks in advanced.  Best regards, Henrik")*

Hi Mohamed

Yes, in $product there is a lot of strings I can show.
But I was looking for the details of the product found in the product-details page, e.g. if unit is 450 gram. In the cart, this will be two strings product_weight: 0.450 and product_weight_unit: kg
So right now, the cart can not show the details I'm looking for. I will have to do some more customization.

Regards,
Henrik

---

.ninja { color: black; visibility: hidden; }
In case of fire:
1. git commit
2. git push
3. exit building

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0Lzg5MTcwMy1zaG93LXdlaWdodC1hbmQtcHJpY2UtcGVyLXVuaXQtaW4tY2hlY2tvdXQtY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Philip](/forum/user/34318-philip "View Philip's Profile")**
- [![Philip's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar34318_2015-11-18-2.png)](/forum/user/34318-philip "View Philip's Profile")
- [ Offline](/forum/user/34318-philip)

Less More

- Posts: 4820
- Thank you received: 654
-
-

9 years 2 months ago -  9 years 2 months ago [\#277116](#277116) by [Philip](/forum/user/34318-philip "View Philip's Profile")  Replied by *[Philip](/forum/user/34318-philip "View Philip's Profile")* on topic *[Show weight and price per unit in checkout cart](/forum/27-checkout/891703-show-weight-and-price-per-unit-in-checkout-cart#277116 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.5 -- PHP version -- : 7.0.10 -- Browser(s) name and version -- : all -- Error-message(debug-mod must be tuned on) -- : none  Hi Hikashop  I'm trying to add a little more information to the customers experience when viewing the checkout cart. I have done some override to show&#95;block&#95;cart.php.  Under product name I would suggest and like that the product&#95;weight is shown. I have added the code below, but I have two problems:  1) the $this-&gt;options&#91;show&#95;product&#95;weight&#93; is not in the array and this is why I have comment it out for now. 2) the $product-&gt;product&#95;weight&#95;unit is all in 'kilo' even though the product has 'gram' as unit.  Under price I would suggest and like that the price&#95;per&#95;unit is shown.  Both information's can be found on the product detail page, from where I have looked for code inspiration.  Thanks in advanced.  Best regards, Henrik")*

Hello,

What is show in your **show\_cart** is a weight and unit that have **already set** in order be a useful data for some shipping method that use
these data to process price.
And so you have to use the function "**hikashop\_get()**" function in order to have **no processed data**, and so have data has you entered it in your product configuration page.

Something must able you to get what you need : Code:

$productClass = hikashop_get('class.product'); $product = $productClass-&gt;get($product_id); echo $product-&gt;product_weight . ' ' . $product-&gt;product_weight_unit;

Hope this will help you.

Regards.

Last edit: 9 years 2 months ago by [Philip](/forum/user/34318-philip "View Philip's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtL2NoZWNrb3V0Lzg5MTcwMy1zaG93LXdlaWdodC1hbmQtcHJpY2UtcGVyLXVuaXQtaW4tY2hlY2tvdXQtY2FydD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.075 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
