Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Add a method to get the total amount of products in a shipment.
Currently I'm using something like this:
$order_total_quantity = null;
foreach ($shipment->getItems() as $shipment_item) {
$shipment_item_quantity = $shipment_item->getQuantity();
$order_total_quantity += $shipment_item_quantity;
}
Comment | File | Size | Author |
---|---|---|---|
#8 | 2940591-8-total-quantity.patch | 2.35 KB | bojanz |
| |||
#6 | commerce_shipping-shipment-total-quantity-2940591-6.patch | 1.97 KB | mitrpaka |
|
Comments
Comment #2
bbuchert CreditAttribution: bbuchert commentedComment #3
bbuchert CreditAttribution: bbuchert commentedComment #4
bbuchert CreditAttribution: bbuchert commentedComment #5
bbuchert CreditAttribution: bbuchert commentedComment #6
mitrpaka CreditAttribution: mitrpaka as a volunteer commentedComment #7
bojanz CreditAttribution: bojanz at Centarro commentedThe individual quantities are strings, so must the total quantity be.
I am not convinced that decimal quantities make sense in Shipping (looks like we just followed Commerce core), but that should be changed all at once, and not in this issue.
Comment #8
bojanz CreditAttribution: bojanz at Centarro commentedUpdated patch.
Comment #10
bojanz CreditAttribution: bojanz at Centarro commentedCommitted #8.