Skip to content
Snippets Groups Projects
Commit 058f5454 authored by Jonathan Sacksick's avatar Jonathan Sacksick
Browse files

Issue #3345552 by jsacksick: php.ERROR: TypeError:...

Issue #3345552 by jsacksick: php.ERROR: TypeError: Drupal\commerce_avatax\AvataxLib::formatAddress().
parent 081df920
No related branches found
No related tags found
No related merge requests found
Pipeline #275778 passed with warnings
......@@ -296,6 +296,11 @@ class AvataxLib implements AvataxLibInterface {
if (is_null($shipment->getAmount())) {
continue;
}
$shipping_profile = $shipment->getShippingProfile();
// Skip shipments with empty addresses.
if (!$shipping_profile || $shipping_profile->get('address')->isEmpty()) {
continue;
}
$request_body['lines'][] = [
'taxCode' => $this->config->get('shipping_tax_code'),
'number' => $shipment->uuid(),
......@@ -304,7 +309,7 @@ class AvataxLib implements AvataxLibInterface {
'quantity' => 1,
'addresses' => [
'shipFrom' => self::formatAddress($store->getAddress()),
'shipTo' => self::formatAddress($shipment->getShippingProfile()->get('address')->first()),
'shipTo' => self::formatAddress($shipping_profile->get('address')->first())
],
];
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment