mc-magento icon indicating copy to clipboard operation
mc-magento copied to clipboard

Fix getAddressData in MailchimpTags build

Open mmenozzi opened this issue 3 years ago • 0 comments

The \Ebizmarts_MailChimp_Model_Api_Subscribers_MailchimpTags::getAddressData method appears to be wrong and this PR aims to fix it.

Prior to this PR:

  • If the customer has a default billing and shipping address but has not any order, its BILLING and SHIPPING tags are not exported, which is wrong.
  • If the customer has at least one order its BILLING and SHIPPING relevant properties are built with the customer's default address anyway, which has no sense at all.
  • In some situations the getAddressData method returns an instance of Mage_Sales_Model_Address instead of an array. This cause an empty JSON object passed to Mailchimp API which leads to the "Data did not match any of the schemas described in anyOf" error.

After this PR, if the customer has a default billing/shipping address it will be always exported as the BILLING/SHIPPING tags regardless the presence of any order.

mmenozzi avatar Jun 10 '21 10:06 mmenozzi