We had a customer recently asking us about OpenCart 3.x not showing product dimension data on the product details page & they couldn't find any answer for this in the OpenCart community or in the search engines. We took a glance at OpenCart 3.x codes and resolved the issue using following steps:
OpenCart has two file locations that generates product data:
1. Core file: public_html/Your-OpenCart-Installation-Path/catalog/controller/product/product.php
2. Theme path: public_html/Your-OpenCart-Installation-Path/catalog/view/theme/YourTheme/template/product/product.twig
Let's begin & hope you have a command session opened with you. Or you can do it using cPanel FileManager / FTP too:
1. Look for following codes in the core file: public_html/Your-OpenCart-Installation-Path/catalog/controller/product/product.php
$data['points'] = $product_info['points'];
2. Add following codes after the above codes:
$data['width'] = $product_info['width'];
$data['height'] = $product_info['height'];
Double check everything & save the file.
3. Open public_html/Your-OpenCart-Installation-Path/catalog/view/theme/YourTheme/template/product/product.twig and look for:
<li>{{ text_stock }} {{ stock }}</li>
4. Add following codes after the above lines:
<li>Dimension: {{ text_width }} {{ width }} x {{ text_height }} {{ height }}</li>
Save the file.
5. Log into OpenCart 3.x Admin area > Extensions/Modifications > Refresh
Check your product page, it must be showing the dimension details.
Note: You can add weight / length too using above steps. Make sure you have a backup of both the files we use above just to be safe.
Do you have a OpenCart website & looking for a best web hosting provider? Join us, we are here to help you & all our servers are Cloud servers. For more details, visit: http://www.samnetworks.in/services/cloud-cpanel-shared-hosting/