Reading list Switch to dark mode

    Magento 2 Replace Add To Cart

    Updated 29 December 2023

    Replace Add to Cart for Magento 2 extension allows the admin to change the standard “Add to Cart” button label with a custom text, link, email or a phone number.

    The customized Add to Cart button can be used for many purposes like – pre-launch products, restrict the product purchase for customers, pre-order products, made to order, call to order products etc.

    The customized Add to Cart button will be displayed on all the products types like – simple, configurable, virtual, downloadable, bundle, and grouped product types.

    And, will be visible on all pages of the store such as the product page, category page, search page, advanced search page, wishlist page, compare page, and other CMS pages.

    Watch the below video tutorial to understand the extension workflow :

    Searching for an experienced
    Magento 2 Company ?
    Find out More
    YteKZ196Y7A

    Features

    • The admin can enable or disable the module.
    • Replace Add to Cart button with a link.
    • The admin can replace Add to Cart button with an email address.
    • Replace Add to Cart button with a phone number.
    • Replace Add to Cart button with a custom text.
    • Add products Ids for which ‘Replace Add To Cart’ will not work.
    • Select categories for which ‘Replace Add To Cart’ will not work.
    • Custom Add to Cart label is visible on the product pages.
    • Custom Add to Cart label is visible on the category pages.
    • The module supports all products types.
    • Custom Add to Cart label is visible on search and advanced search pages.
    • Custom Add to Cart label is visible on wishlist page.
    • The module source code is open for customization.
    • Custom Add to Cart label is visible on compare page.
    • Custom Add to Cart label is visible on CMS pages.
    • The customer can’t check out the product for which the Add To Cart button has been replaced with the link, email and phone number.

    Installation

    The installation is quite simple just like the standard Magento 2 extensions.

    Customers will get a zip folder and they have to extract the contents of this zip folder on their system.

    The extracted folder has an src folder, inside the src folder you have the app folder. You need to transfer this app folder into the Magento 2 (Adobe Commerce) root directory on the server as shown below.

    INSTALLATION

    After the successful installation, you have to run these commands in the Magento 2 root directory.

    First command – php bin/magento setup:upgrade

    cmd1

    Second Command – php bin/magento setup:di:compile

    cmd2

    Third Command – php bin/magento setup:static-content:deploy

    cmd3

    After running the commands, you have to flush the cache from the Magento admin panel by navigating through->System->Cache management as shown below.

    INSTALLATION

    Multi-Lingual Configuration

    For Multilingual support, please navigate to Store>Configuration>General >Locale Options. And select your desired language from the Locale option.

    change-language-magento-2-locale

    Language Translation

    For module translation, navigate to the following path in your system  app/code/Webkul/ReplaceAddToCart/i18n/en_US.csv. Open the file named en_US.CSV for editing as shown in the below screenshot.

    LANGUAGE TRANSLATION

    Then replace the words after the comma(,) on the right in the file with your translated words.

    CSV

    After editing and translating the CSV file, you need to save the translated file name according to your region language and country code such as – de_DE.CSV. Followed by uploading the translated file to the same folder from where you have obtained it. Now your module translation is complete.

    Language translation

    Module Configuration

    After the installation, the admin can easily configure the module settings. For this, the admin will navigate to Stores -> Configuration ->Webkul -> Replace Add To Cart as shown below.

    Configuration-Settings-Stores-Magento-Admin

    Here, the admin will:

    Enable – Select Yes to enable the module. Else, set No to disable it.

    Replace Add To Cart – Select the options from the drop-down the admin wants to replace with Add To cart button.

    Configuration-Settings-Stores-Magento-Admin-1

    Once will click on drop-down following four fields will display:

    • Text: Select Text If admin wants to replace add to cart with Text from the drop-down. Label options will appear once admin select Text as shown below:

    text-field

    • Link: Select Link If the admin wants to replace add to cart with a Link from the drop-down. A Label and URL options will appear under the Link field. The admin will enter the label and URL respectively as shown below:

    Configuration_Settings_Stores_Magento_Admin_3

    • Email: Select Email If admin wants to replace add to cart with an Email from the drop-down. An Email Id option will appear against the email field. The admin will enter the email as shown below:

    email_replact_add_to_cart

    • Phone: The admin will enter the phone number if selected the Phone as an option for Replace Add To Cart field as shown below.

    selected-option-1

    Select CategoryOn the selected categories, the “Replace Add to Cart” extension functionality will not work. The selected categories will continue to show default Add to Cart on the storefront same as before.

    Product Ids – Here the admin can enter the product Ids for which ‘Replace Add To Cart’ will not work.

    Replace “Add To Cart” Button By “Email Address” – Front-End

    If the admin has set Email as an option for Replace Add To Cart field, then it will be visible on the following pages.

    Category Page:

    In place of Add to cart button, the configured email address will be visible on the category page.

    category

    Product Page:

    In place of Add to cart button, the configured email address will be visible on the product page.

    product

    Compare Page:

    In place of Add to cart button, the configured email address will be visible to customers on the compare page.compare

    Search Page:

    In place of Add to cart button, the configured email address will be visible to the customers on search page

    search

    Advanced Search:

    In place of Add to cart button, the configured email address will be visible on the advanced search page.

    advanced search

    Wishlist:

    In place of Add to cart button, the configured email address will be visible to customers on the wishlist page.

    My-Wish-List

    CMS Page:

    In place of Add to cart button, the configured email address will be visible to the customers on the CMS page as shown below.

    cms

    Replace “Add To Cart” Button By “Phone Number” – Front-End

    If the admin has set Phone as an option for Replace Add To Cart field, then it will be visible on the following pages.

    Category Page:

    In place of Add to cart button, the configured phone number will be visible to the customers on the category page as shown below.

    category

    Product Page:

    In place of Add to cart button, the configured phone number will be visible to the customers on the product page as shown below.

    product

    Compare Page:

    In place of Add to cart button, the configured phone number will be visible to the customers on the compare page as shown below.

    compare

    Search Page:

    In place of Add to cart button, the configured phone number will be visible to the customers on the search page as shown below.

    search

    Advanced Search:

    In place of Add to cart button, the configured phone number will be visible to the customers on the advanced search page as shown below.

    advanced search

    Wishlist:

    In place of Add to cart button, the configured phone will be visible to the customers on the wishlist page as shown below.

    My-Wish-List-1

    CMS Page:

    In place of Add to cart button, the configured phone number will be visible to the customers on the CMS page as shown below.

    cms

    If the admin has set Link as an option for Replace Add To Cart field, then it will be visible on the following pages.

    Category Page:

    In place of Add to cart button, the configured link will be visible to the customers on the category page as shown below.

    category

    Product Page:

    In place of Add to cart button, the configured link will be visible to the customers on the product page as shown below.

    product

    Compare Page:

    In place of Add to cart button, the configured link will be visible to the customers on the compare page as shown below.

    compare

    Search Page:

    In place of Add to cart button, the configured link will be visible to the customers on the search page as shown below.

    search

    Advanced Search:

    In place of Add to cart button, the configured link will be visible to the customers on the advanced search page as shown below.

    advanced search

    Wishlist:

    In place of Add to cart button, the configured link will be visible to the customers on the wishlist page as shown below.

    My-Wish-List-2

    CMS Page:

    In place of Add to cart button, the configured link will be visible to the customers on the CMS page as shown below.

    cms

    Replace “Add To Cart” Button By The “Text” – Front-End

    If the admin has set Text as an option for Replace Add To Cart field. then it will be visible on the following pages.

    Note: The Text entered by the admin is just a label for the button and hence, the functionality of the button Replace “Add to Cart” always remains the same, no matter whatever text is entered by the admin.

    Category Page:

    In place of Add to cart button, the configured custom text will be visible to the customers on the category page as shown below.

    category

    Product Page:

    In place of Add to cart button, the configured custom text will be visible to the customers on the product page as shown below.

    product

    Compare Page:

    In place of Add to cart button, the configured custom text will be visible on the compare page.

    compare

    Search Page:

    In place of Add to cart button, the configured custom text will be visible on the search page.

    search

    Advanced Search:

    In place of Add to cart button, the configured custom text will be visible on the advanced search page.

    advanced search

    Wishlist:

    In place of Add to cart button, the configured custom text will be visible to the customers on the wishlist page as shown below.

    My-Wish-List-3

    CMS Page:

    In place of Add to cart button, the configured custom text will be visible to customers on the CMS page.

    cms

    Shopping Cart

    If a customer tries to check out the product for which the Add to cart button has been replaced by a link, email, or phone. Then, the following error message will be displayed as per the configuration set.

    • Add to cart button has been replaced by Email.

    mail

    • When Add to cart button has been replaced by Phone.

    phone number

    • When Add to cart button has been replaced by Link.

    link

    Note: The customers can easily add the products to the cart and checkout when Add to cart button is replaced by the custom Text.

    Cart Replacement Based on Product

    For an instance, if the same product is added under two categories even if only one of the categories is selected to restrict “Replace add to cart” functionality.

    On the Front end:

    Add to cart button will still appear, rather than Replace add to cart.

    Since for that particular product in the back end Admin has configured to restrict “Replace Add to cart” by listing its Product Id, and Hence it will reflect on the front end based on product.

    blog-rac-cart replacement

    That’s all for Magento 2 (Adobe Commerce) Replace Add To Cart module. Still, have any issues please feel free to add a ticket at  https://webkul.uvdesk.com/

    Explore the Adobe Commerce Cloud development services by Webkul.  Also, other quality Magento 2 extensions.

    Current Product Version - 5.0.0

    Supported Framework Version - Magento 2.0.x, 2.1.x, 2.2.x,2.3.x, 2.4.x

    Blog Version - Magento 2.0.x, 2.1.x, 2.2.x,2.3.x, 2.4.x
    • Version 2.0.x, 2.1.x, 2.2.x
    • Version 2.0.x, 2.1.x, 2.2.x, 2.3.x, 2.4.x
    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    Be the first to comment.

    Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content