How is the «Magento_Customer/js/customer-data» object implemented and used?

tax
review
wishlist
magento_customer-js-customer-data
module-theme
customer
design-pattern
frontend-checkout-data
frontend-checkout-customer-data
paypal
javascript
sales
checkout

(Dmitry Fedyuk) #1

The Magento_Customer/js/customer-data object is a client-side registry of the current customer data.

Context: How to get the customer’s data on the frontend checkout page’s client side (with JavaScript)?

How is it implemented?

Usage examples

1. Magento_Catalog/js/view/compare-products.js

2. Magento_Checkout/js/checkout-data.js

3. Magento_Checkout/js/sidebar.js

4. Magento_Checkout/js/model/address-converter.js

5. Magento_Checkout/js/view/billing-address.js

6. Magento_Checkout/js/view/minicart.js

7. Magento_Checkout/js/view/checkout/minicart/subtotal/totals.js

8. Magento_Checkout/js/view/shipping-address/address-renderer/default.js

9. Magento_Checkout/js/view/shipping-information/address-renderer/default.js

10. Magento_Customer/js/action/login.js

11. Magento_Customer/js/view/authentication-popup.js

12. Magento_Customer/js/view/customer.js

13. Magento_Paypal/js/in-context/express-checkout.js

14. Magento_Paypal/js/view/payment/method-renderer/paypal-express-abstract.js

15. Magento_Paypal/js/view/payment/method-renderer/in-context/checkout-express.js

16. Magento_Review/js/view/review.js

17. Magento_Sales/js/view/last-ordered-items.js

18. Magento_Tax/js/view/checkout/minicart/subtotal/totals.js

19. Magento_Theme/js/view/messages.js

20. Magento_Wishlist/js/view/wishlist.js


The difference between «window.customerData», «Magento_Customer/js/customer-data», and «Magento_Customer/js/model/customer» on a frontend checkout page
How to get the checkout data on the frontend checkout page's client side (with JavaScript)?
(Dmitry Fedyuk) #2

See also:


(Wang Yunwei) #3

Hi, I’ve been following your post for one year. Those are very helpful. Thank you for your sharing. But I have some questions about https://mage2.pro/t/topic/1246. According to the test of my website, I found its order that “magento/magento2/blob/072a1ae/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js#L12-L13” came first, and then is “magento/magento2/blob/072a1ae/app/code/Magento/Customer/view/frontend/web/js/customer-data.js#L185-L188”. The magento version is 2.2.4.