craftcms / commerce

Fully integrated ecommerce for Craft CMS.
https://craftcms.com/commerce
Other
215 stars 169 forks source link

Updated `CustomerBehavior` and `CustomerAddressBehavior` to add properties to `toArray()` returns #3540

Closed nfourtythree closed 3 weeks ago

nfourtythree commented 3 weeks ago

Description

Currently, if you are in twig you have access to primaryBillingAddressId and primaryShippingAddressId on the User element, and isPrimaryBilling and isPrimaryShipping on the Address element.

However these properties were missing from the fields definitions for both of these elements. There for if you were interacting with the system via AJAX you would not receive those properties as part of the responses.

This PR adds those in as well as attempts to optimise both the user and address queries to try and negate any performance issues.