This is relatively simple if you understand the MVC (Model, View, Controller) pattern. Here are the steps required:
- You need to add the logic for fetching the product weight in the controller file and pass it to the view
catalog/controller/product/product.php
On line 283 (right after the price because it is a nice place for it) add this code
$data['weight'] = $product_info['weight'] + 0 ;
(the + 0 removes the zeros and makes it looks nicer)
- Then you need to display it in your view template file
catalog/view/theme/default/template/product/product.twig
on line 162 add:
{{weight}}
If you don’t see the changes, that is because you have twig Cache turned on. Go to admin/dashboard and on the top right corner find the gear button. click it and click refresh cache. you can also turn off the cache while you are in development mode. http://joxi.ru/LmGewYZiwBW0zA
2
solved Display Weight under Price in Product Page & Search page [closed]