سؤال

I am using the mageworx customer special price module. But it messes up my cache by adding a unique user id to the cache generation. How can I hide prices and add them on load using ajax? enter image description here enter image description here

هل كانت مفيدة؟

المحلول

use Ui Components in this case, to get or modify the price in the category or product pages.

no need to use AJAX calls use Ui Components instead

Its well described here in this guide

  1. locate the javascript ui components used in the product and category pages
  2. Override them in your requirejs
  3. use a mix-in and get or modify the prices

added a few links below for your reference

Format price with javascript in Magento 2

Magento2 - How to use Magento_Catalog/js/price-box to format price in template?

Magento 2: How to include JS on the product page?

Magento2: How can I override core js module price-box.js

Magento 2: Add to Cart JS Override works on product page but not on category page

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top