dispositiontools / craft-commerceinsights

Get insights from Craft Commerce
Other
1 stars 1 forks source link

Missing billing address causes error #12

Closed pixelmachine closed 10 months ago

pixelmachine commented 10 months ago

I have an order that for some reason has no billing address. This causes Commerce Insights (v3 branch) to throw an error.

It looks like the issue is in the Products Service, where there's a check that the Shipping address exists but then data is pulled from the Billing address which may not:

if($shippingAddress){
  $addressShippingDetails = [
    'shippingBusinessName' => $billingAddress->businessName ,
     'shippingFirstName' => $billingAddress->firstName ,
     'shippingLastName' => $billingAddress->lastName ,
     'shippingAddress1' => $billingAddress->address1 ,
     'shippingAddress2' => $billingAddress->address2 ,
     'shippingAddress3' => $billingAddress->address3 ,
     'shippingCity' => $billingAddress->city ,
     'shippingPostcode' => $billingAddress->zipCode ,
   ];
}

I assume that's just a typo.

dispositiontools commented 10 months ago

thanks for bringing this to my attention - I'll get this fixed today

dispositiontools commented 10 months ago

I've pushed the update for the v3 branch with the fix. tag v1.0.15 Thanks again @pixelmachine for spotting this.