Paazl Shipping - Call to a member function getFoomanTotalGroup() on array

The Paazl Shipping extension unfortunately sets extension attributes on the address object to an array which should not be possible. The developers themselves have acknowledged this with a note in their code:

@todo Temporary file until I find a cleaner way to alter the payload / set the extension attributes server side.

This in turn triggers the following error message in our code:

{"messages":{"error":[{"code":500,"message":"Fatal Error: 'Uncaught Error: Call to a member function getFoomanTotalGroup() on array in /public_html\/vendor\/fooman\/surcharge-core-m2\/src\/Model\/Total\/Quote\/Surcharge.php:163
Stack trace:
#0 /public_html\/vendor\/fooman\/surcharge-core-m2\/src\/Model\/Total\/Quote\/Surcharge.php(120): Fooman\\Surcharge\\Model\\Total\\Quote\\Surcharge->removeInactiveSurcharges(Object(Magento\\Quote\\Model\\Quote\\Interceptor), Array)
#1 /public_html\/vendor\/magento\/module-quote\/Model\/Quote\/TotalsCollector.php(274): Fooman\\Surcharge\\Model\\Total\\Quote\\Surcharge->collect(Object(Magento\\Quote\\Model\\Quote\\Interceptor), Object(Magento\\Quote\\Model\\ShippingAssignment), Object(Magento\\Quote\\Model\\Quote\\Address\\Total))
#2 /public_html\/vendor\/magento\/module-quote\/Model\/ShippingMethodManagement.php(303): Magento\\Quote\\Model\\Quote\\TotalsCollector->collectAddressTotals(Object(Magento\\Quote\\Model\\Quote\\Interceptor), Object(Paazl\\Shipping\\Model\\Quote\\Address\\Interceptor))
#3 /public_html\/ve' in '/public_html\/vendor\/fooman\/surcharge-core-m2\/src\/Model\/Total\/Quote\/Surcharge.php' on line 163","trace":"Trace is not available."}]}}
	

Until this issue is addressed in the Paazl Shipping extension you can apply the following edit to /app/code/Paazl/Shipping/Model/PaazlManagement.php and change the below

	} else if (is_array($extensionAttributes)) {
                    if (!empty($extensionAttributes['checkout_fields'])) {
                        $streetName = $extensionAttributes['street_name'];
                        $houseNumber = $extensionAttributes['house_number'];
                        $addition = null;
                        if (isset($extensionAttributes['house_number_addition'])) {
                            $addition = $extensionAttributes['house_number_addition'];
                        }
	             }
                }
	

to read

	} else if (is_array($extensionAttributes)) {
                    $addressExtension = $this->addressExtensionFactory->create();
                    if (!empty($extensionAttributes['checkout_fields'])) {
                        $streetName = $extensionAttributes['street_name'];
                        $houseNumber = $extensionAttributes['house_number'];
                        $addition = null;
                        if (isset($extensionAttributes['house_number_addition'])) {
                            $addition = $extensionAttributes['house_number_addition'];
                        }
                        $addressExtension->setStreetName($streetName);
                        $addressExtension->setHouseNumber($houseNumber);
                        $addressExtension->setHouseNumberAddition($addition);
                    }
                    $address->setExtensionAttributes($addressExtension);
                }

Still need help? Contact Us Contact Us