cancel
Showing results for 
Search instead for 
Did you mean: 

Unsubscription Link in Success Mail

Unsubscription Link in Success Mail

want to add an unsubscription link to my success mail from Magento (2.x), but all the variables I tried so far are not generating a link.

 

{{var subscriber.getUnsubscriptionLink}}

{{var subscriber.getUnsubscribeUrl}}

{{var subscriber_data.unsubscription_link}}

{{var subscriber_data.unsubscription_url}}

{{var subscriber.getUnsubscriptionLink()}

 

I know this question has been asked several times in the past, but I could not find any helpful answer.

 

Is it even possible to put an unsubscription link into success mails / transactional mails?

 

Thank you in advance!

2 REPLIES 2

Re: Unsubscription Link in Success Mail

Hello @yannicknae2ffc 

 

To add an unsubscribe link to the success mail in Magento 2, you will need to modify the appropriate email template file and include the unsubscribe link within the content of the email. Please follow the steps below for the same:

  • Identify the success email template:
    • In your Magento 2 installation, go to the app/design/frontend/{Vendor}/{Theme}/Magento_Sales/templates/email directory. This is where the email templates for sales-related emails, including the success email, are located. {Vendor} refers to the name of your theme's vendor, and {Theme} refers to the name of your theme.
  • Create a backup:
    • Before making any changes, it's always a good practice to create a backup of the email template file that you are going to modify. This allows you to easily revert to the original file if needed.
  • Edit the success email template:
    • Open the success.phtml file in a text editor, which corresponds to the success email template. You can add an unsubscribe link to the content of the email, typically at the bottom or in the footer section. You can use HTML and inline CSS to customize the appearance of the link. For example:
      <p>
      Thank you for your purchase from our store. If you wish to unsubscribe from future emails, you can do so by clicking 
      <a href="{{config path='web/unsecure/base_url'}}newsletter/manage/unsubscribe/">here</a>.
      </p>
    • The above example assumes that you have a newsletter module installed in your Magento 2 store, and the unsubscribe link is generated using the {{config path='web/unsecure/base_url'}}newsletter/manage/unsubscribe/ URL. Make sure to update the URL to match the unsubscribe URL of your specific newsletter module or extension.
  • Save the changes:
    • Please save the modified success.phtml file after adding the unsubscribe link.
  • Clear cache and test:
    • After making changes, clear the cache in Magento 2 and place a test order to trigger the success email. Verify that the unsubscribe link appears correctly in the email and functions as expected.

If you find our reply helpful, please give us kudos.

 

A Leading Magento Development Agency That Delivers Powerful Results, Innovation, and Secure Digital Transformation.

 

WebDesk Solution Support Team

Get a Free Quote | | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789

Thank You,


WebDesk Solution Support Team
Get a Free Quote | Email | Adobe Commerce Partner | Hire Us | Call Us 877.536.3789


Location: 150 King St. W. Toronto, ON M5H 1J9

Re: Unsubscription Link in Success Mail

It's not working, I get 404.