0

The "Add to Cart" Button text is not translating correctly after the product has been added to the cart. Please see below for screenshots of the issue.

On product page load, the translation for the "Add to Cart" is working as expected and button is translated to "Add to Basket" as shown in the image below.

The Product goes through the process of being added to the cart as expected, but when the add to cart process is completed the "Add to Cart" button shows the default string rather than the translation as show in the image below.

How can i fix it, thank you!

0

You should override catalog-add-to-cart.js file in your theme.

create app/design/frontend/[vendor]/[theme]/Magento_Catalog/web/js/catalog-add-to-cart.js file.

Find:

var addToCartButtonTextDefault = self.options.addToCartButtonTextDefault || $t('Add to Cart');

Replace it to:

var addToCartButtonTextDefault = self.options.addToCartButtonTextDefault || $t('Add to Basket');
2

1.You need to rename "Add to Cart" button to "Add to Basket". To do this follow below path.

app/i18n/[custom]/en_US/en_US.csv

add below the words in csv.

"Add to Cart","Add to Basket"

It will change every where text of "Add to Cart" button is visible.

  • i tried but not wokring. it will "Add to Basket" > "Add.." > back to "Add to Cart" @PareshaU – niceonelee Mar 29 '18 at 8:08
  • you can also put it in your custom theme. app/design/frontend/[vendor]/[theme]/i18n/en_US.csv. after do the changes please run commands:bin/magento setup:upgrade,bin/magento setup:static-content:deploy,bin/magento cache:flush – P_U Mar 29 '18 at 8:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.