The DefaultWeightCalculationService exposes methods to compare weights and to get the total weight of a package.
Total package weight can be calculated from either a FulfillmentPricingRequest for carts during checkout or an OrderFulfillment when creating shipping labels for submitted orders.
The weight conversions are handled by the Indriya library and the details are beyond the scope of this document.
The pieces come together in the #sumWeights
method, where each item’s com.broadleafcommerce.shipping.domain.Weight
is converted to a tech.units.indriya.ComparableQuantity
and summed with tech.units.indriya.ComparableQuantity#add
.