🔥 Just Launched! Werra Premium Template for HyväSee it in Action

How to Auto Apply Coupon Code in Magento 2? – Step-wise Process

By Vishal DaveUpdated on Apr 23, 2025 5 min read

Running a sales campaign? Make it even more effective by automatically applying a discount code in Magento 2.

Imagine you’re promoting holiday discount offers in your store. You’ll need to create a coupon code that customers can apply to claim the offer. But what if we automate the later part of this process? The customers can automatically claim the discount offer and happily complete their purchase.

In this post, we’ll explore the step-by-step process on Magento 2 auto apply coupon code.

How to Auto Apply Coupon Codes in Magento 2?

To auto-apply coupon code in Magento 2, you’ll need the Magento 2 Coupon Code Link extension. It helps you generate links you can share with your customers, following which the discount code is automatically applied.

You can use this extension to generate links that you can add to your website, social media, and distribute it across other channels.

Step 1: Configure Auto Apply Coupon Code Settings

In your Magento 2 admin, go to Coupon Code Link > Configure to set up the extension.

configure magento 2 coupon code link extension

In the extension configuration, set Coupon Code Link to “Enable.” You can also enable and customize success & error messages to show on the page.

enable magento 2 coupon code link extension

Customize the success & error messages like the one shown below. You can add images, widgets, or even custom HTML code.

customize success message

The extension also supports sharing the coupon code links directly on social media platforms and via email. You can configure the optional Facebook ID and email settings.

Once done, click the “Save Config” button.

In your Magento admin left menu, navigate to Coupon Code Link > Manage Coupon Code Links.

manage coupon code links

This grid will display all the links to auto apply coupon codes in Magento 2 that you’ve created.

Click the Update button as shown below to update the grid with all the coupon codes that you’ve created in your store.

update copon code links

Now, click the coupon code that you want to generate a link for and enter the Redirect URL (i.e. the page where you want to redirect the customer on clicking the link. For e.g., a category page.)

The extension will generate a coupon code link with redirection, as shown below. Copy the link.

copy coupon code link

Optionally, you can also use the other options in the grid to email the link to customers or share it on social media.

Now, you can promote the copied links on your website via banners or CTAs to auto apply coupon codes in Magento 2.

In the following example, I have added the coupon code link to a product page.

add auto apply coupon code link to magento

The link takes the user to the set redirect page (which is the product page in this example.)

The discount offer code is automatically applied once they add the products to the cart. And the success message is displayed as configured in the backend.

magento auto apply coupon code

See how the Magento 2 Coupon Code Link extension enabled automatic discount on cart/checkout in Magento 2. You can also use the extension to share the coupon code links on social media channels and make it easy for your customers to claim the discounts.

Magento 2 Coupon Code Link

Convert coupon codes to link that apply discount directly at checkout.

Get Extension

In Magento 2, auto applying coupon codes via links can help you improve customer’s journey with the store. The above tutorial demonstrates how you can do that using our Magento 2 Coupon Code Link extension.

You can use the coupon code link in Magento 2 to improve your sales in a number of ways. Here are some:

  • Distribute the code links to your existing customers via newsletters
  • Run social media campaigns to promote the sales discount offers
  • Place CTAs on your website pages and announcement bars with buttons
Vishal Dave Full Image
Article byVishal Dave

Vishal is a technical writer, editor, and digital marketer with over four years of experience. On weekends, you can find him enjoying sunsets or reading books.