Answer the question
In order to leave comments, you need to log in
How to display the name of the weight unit in opencart 3?
There are weight units in the admin panel, I added the necessary ones, I try to display the latest (new arrivals) in the native plugin, for this I did:
1) controller
2) twig
I get the result, but not the one, instead of the name of the unit (for example - kg / g / l / ml ) I get its ordinal number (1/2/3/4....)
How can I display the name of the weight unit?
'weight_class' => $result['weight_class_id'],
{{product.weight_class}}
Answer the question
In order to leave comments, you need to log in
I found it, take it to whoever needs it,
'weight' => (float)$result['weight'], //(вывели сам вес (численное значение с округлением))
'unit' => $this->weight->getUnit($result['weight_class_id']), // (а тут вывели наименование его единицы веса)
Вес: {{weight}} {{unit}}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question