0

Add to cart button not working on product page in magento 2.4.4. [enter image description here][1]

(1) Magento_Catalog/templates/product/view/form.phtml

` require([ 'jquery', 'priceBox' ], function($){ var dataPriceBoxSelector = '[data-role=priceBox]', dataProductIdSelector = '[data-product-id=escapeHtml($_product->getId()) ?>]', priceBoxes = $(dataPriceBoxSelector + dataProductIdSelector);

priceBoxes = priceBoxes.filter(function(index, elem){
    return !$(elem).find('.price-from').length;
});

priceBoxes.priceBox({'priceConfig': <?= /* @escapeNotVerified */ $block->getJsonConfig() ?>});

});

`

(2) UPDATE core_config_data SET value = REPLACE(value, 'http://magento246.local/', 'http://magento246.local/') WHERE path = 'design/head/includes';

(3) setup:upgrade,setup:di:compile,indexer:reindex,setup:static-content:deploy -f,cache:flush,cache:clean,rm -rf var/cache/*

(4) [enter image description here][2]

I solved in many ways but this bug is not fixed.Above are some of those methods.

This problem is coming occasionally. Doesn't always come And it is coming in all 6 types of products.

It comes only on the product page. If we add to cart from category page then it does not come that bug.

If I page from category then I do cart. Then after that, if I do it on the product page, then this bug does not come.

This bug comes when I do it directly on the product page.

There was no ad cart at that time.

(Magento2.4.4)

yes i tried to solve but this bug is not fixed.



  [1]: https://i.stack.imgur.com/cGbHd.png
  [2]: https://i.stack.imgur.com/Yyo2v.png

1 Answers1

0

try this

{ "[data-role=priceBox][data-price-box=product-id-escapeHtml($_product->getId()) ?>]": { "priceBox": { "priceConfig": getJsonConfig() ?> } } }

  • Not Working.put this code this script.I used it like this.The code is given below. – Vishvnath Jain Aug 31 '23 at 06:09
  • – Vishvnath Jain Aug 31 '23 at 06:14
  • ;var additionalPriceBoxConfig = {"priceBox": {"priceConfig": = /* @escapeNotVerified */ $block->getJsonConfig() ?>}};$(dataPriceBoxSelector + '[data-price-box=product-id-= $block->escapeHtml($_product->getId()) ?>]').priceBox(additionalPriceBoxConfig);}); – Vishvnath Jain Aug 31 '23 at 06:14