I have a phtml file that needs to load the weight unit of the product, the weight unit is from the store configuration, is there a way to do this?
Magento – Get product weight unit in phtml file
configurationmagento2product-weight
configurationmagento2product-weight
I have a phtml file that needs to load the weight unit of the product, the weight unit is from the store configuration, is there a way to do this?
Best Answer
For product weight unit. Try this -
You need to use the instance of
\Magento\Framework\App\Config\ScopeConfigInterface
in your block:Create the method
getWeightUnit()
and call in your template
echo $this->getWeightUnit();