0

PreRequisites:

  • MageVersion - Magento 2.3.x
  • External JavaScript - http://domain.com/external-js.js

    var mage_customer_group = ''; //other code related to the customer group

  • Pages - Category page and Custom product listing page (External JavaScript manages the product listing using simple AJAX)

Getting Customer group name by overriding customer section updates and saving into the mage-cache-storage (localstorage).

https://devdocs.magento.com/guides/v2.3/extension-dev-guide/cache/page-caching/private-content.html

https://belvg.com/blog/customer-data-management-in-magento-2.html

In external-js.js file, 3rd party vendor having logic to send prices and other information based on customer group name. For now, product name, image, link and product price is showing proper. Issue only occures, when category or custom product listing page loads value of mage_customer_group is getting blank value.

While looking on the Network console, first External JavaScript (http://domain.com/external-js.js) calling then customer section update is calling.

Is there any way in KnockOut js that we can bind customer properties to external JS?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.