Magento 2 Replace Add To Cart

Using Magento 2 Replace Add To Cart module, the admin can 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- product page, category page, search page, advanced search page, wishlist page, compare page, and other CMS pages.

Features

The admin can enable or disable the module.

Replace Add to Cart button with a link.

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.

Custom Add to Cart label is visible on search and advanced search pages.

Custom Add to Cart label is visible on wishlist page.

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.

The module supports all products types.

The module source code is open for customization.

Installation

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 Magento2 root directory on the server as shown below.

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

First command – php bin/magento setup:upgrade

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

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

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

Multi-Lingual Configuration

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.

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

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.

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.

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.

Third configuration field is dependent on Replace Add To Cart field. Example – the admin will enter the phone number in the third field if selected the Phone as an option for Replace Add To Cart field as shown below.

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

Select Category – Here the admin can select the categories for which ‘Replace Add To Cart’ will not work.

The same will be followed for other options of Replace Add To Cart field.

Like – Replace Add To Cart “Link” options :

Enable –Here admin can choose “Yes” to enable the module and “No” to disable the module.

Replace Add To Cart – In this section, the selection option is “Link”.

Label –Label of the URL, which will be displayed to the user.

URL – Redirect URL.

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

Select Category – Here the admin can select the categories 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 to the customers on the category page as shown below.

Product Page:

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

Compare Page:

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

Search Page:

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

Advanced Search:

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

Wishlist:

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

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.

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.

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.

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.

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.

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.

Wishlist:

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

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.

Replace “Add To Cart” Button By A “Link” – Front-End

If the admin has set Linkas 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.

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.

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.

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.

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.

Wishlist:

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

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.

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.

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.

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.

Compare Page:

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

Search Page:

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

Advanced Search:

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

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.

CMS Page:

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

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.

When Add to cart button has been replaced by Email.

When Add to cart button has been replaced by Phone.

When Add to cart button has been replaced by 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.

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