I am trying to override




in order to change the "Add to Cart" button text. I modified the only instance of "Add to Cart" in the js file.

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

I fired cache:clean, cache:flush, setup:upgrade, but the text is still not changing. What step am I missing?

4 Answers 4


There are 2 places where you need to change the text and then it will show your changes these are ( if these files are not in your theme then place these files in your theme folder , where i assume **/Vendor/theme** is your theme folders ):

1 - /Vendor/theme/Magento_Catalog/templates/product/view/addtocart.phtml in this file you should change

<?php **$buttonTitle = __('Add to Basket');** ?>

this will change button title but only when it will load the page , but when you will hit that button it will change back to "Add to cart". So you need to make change in js file ( which you have mentioned in your question already )

2 - /Vendor/theme/Magento_Catalog/web/js/catalog-add-to-cart.js

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

If you are already in developer mode then :

After making these changes you just need to run cache:clean command if that still not work then deploy:static:content.


you just need to add your text into language csv file, no need to override any js file


add like "Add to Cart","Add to Basket"

run below command

php bin/magento setup:upgrade && php bin/magento setup:static-content:deploy -f

check your changes.


To change the text of "Add to Cart" button, you need to do changes in its view template file.

-- Enable template path hint from admin and find the path of template file of that button.

-- Override that template view file in your theme folder and then do required changes.


Your rrequirement is to change text of "Add To Cart" button then you need to do using custom extension by overiding this.

  1. You need to overide "addtocart.phtml" file.


        <referenceBlock name="product.info.addtocart">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Extension::catalog/product/view/addtocart.phtml</argument>

    1. create template file "addtocart.phtml" file at this location.


Into this file, copy orignal file code, just replace this line.

<?php $buttonTitle = __('Add to Cart'); ?>


<?php $buttonTitle = __('Add to Basket'); ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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