diff --git a/Plugin/AddWeightUnitToOrderPlugin.php b/Plugin/AddWeightUnitToOrderPlugin.php index 6beb3c830db33003f982413eac77ce68dfa17206..8efcf0df16cdfcc490f6e0c4ed92b3a8afa18855 100644 --- a/Plugin/AddWeightUnitToOrderPlugin.php +++ b/Plugin/AddWeightUnitToOrderPlugin.php @@ -29,12 +29,19 @@ class AddWeightUnitToOrderPlugin \Magento\Store\Model\ScopeInterface::SCOPE_STORE ); - if ($weightUnit) { + if ($weightUnit === 'lbs') { foreach ($order->getItems() as $orderItem) { - $orderItem->setData('product_type', $weightUnit); + // Get the current weight of the item + $weight = $orderItem->getWeight(); + + // Convert weight from lbs to kg + $convertedWeight = $weight * 0.45359237; + + // Set the converted weight back to the item + $orderItem->setData('weight', $weight); } } - + return [$order]; } }