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.
I have tried to implement a shipping module that utilizes the packaging module, but I haven't been very successful. Packaging returns only a single PackagingPackage object without weight or volume. I would expect a number of packages returned considering the products being passed using
$packages = packaging_package_products($context, $products);
This is what is returned
Array
(
[0] => PackagingPackage Object
(
[quantity:protected] => 0
[price:protected] => 0
[weight:protected] => 0
[weight_units:protected] => KG
[volume:protected] => 0
[length_units:protected] => IN
[shipweight:protected] => 0
[products:protected] => Array
(
)
)
)
Comment | File | Size | Author |
---|---|---|---|
#2 | packaging_commerce-2598334-2.patch | 1.06 KB | jcherbert |
Comments
Comment #2
jcherbert CreditAttribution: jcherbert commentedI found that none of the product object keys are being passed for Commerce Products. This is evident in classes/products.inc in function constructFromCommerceProduct
See attached patch which I believe fixes this issue.
The packaging algorithms can then be invoked using something like:
Comment #4
jcherbert CreditAttribution: jcherbert commented