Magento 2 Import Coupon Codes

Table of Content

  1. Extension Installation
  2. Configuration
  3. Import Coupon Codes from Backend
  4. Custom Coupon Codes Applied in Frontend

 

  1. Extension Installation
  • For Magento Marketplace Customers
  • Create a folder structure in Magento root as app/code/Meetanshi/CartRulesCsv
  • Download and extract the zip folder and upload our extension files to the app/code/Meetanshi/CartRulesCsv via FTP.
  • Login to your SSH and run below commands step by step:
  • php bin/magento setup:upgrade
  • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
  • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
  • php bin/magento cache:flush

 

  • For Meetanshi Customers
  • Extract the zip folder and upload our extension to the root of your Magento 2 directory via FTP.
  • Login to your SSH and run below commands step by step:
  • php bin/magento setup:upgrade
  • For Magento version 2.0.x to 2.1.x - php bin/magento setup:static-content:deploy
  • For Magento version 2.2.x & above - php bin/magento setup:static-content:deploy –f
  • php bin/magento cache:flush

 

  1. Configuration
    To configure the extension, login to Magento 2, move to Marketing à Cart Price Rules where you can find a ‘Cart Price Rules’ grid. Make sure you have created at least one cart price rule to import coupon codes under the created cart price rule. Select and edit a cart price rule to enable the tab to import coupon codes through CSV.

 

  1. Import Coupon codes from Backend
    On cart price rule edit page, expand an “Import Coupon Codes” tab. You can import coupon codes through CSV file from this tab.
  • Click on “Download Sample CSV” to download the sample CSV file with coupon codes. It has coupon codes, usage limit and usage per customer values. Your own coupon codes CSV must have the same format as in the sample CSV file.

 

  • Now, click on the “Choose File” button to upload the coupon codes CSV file having your custom coupon codes.
  • Once the CSV file is uploaded, click on ‘Upload File’ to import coupon codes from the uploaded CSV.

  • Imported Coupon Code Listed under Manage Coupon Codes
    After the CSV import is completed, all the coupon codes enlisted under the ‘Manage Coupon Codes’ tab. The admin can use these coupon codes to place order from the backend or send to the customers directly to use them in the frontend.

 

  1. Custom Coupon Codes Applied in Frontend
    Once coupon codes are imported and saved in the backend, both the admin and customers can use them by applying them directly on cart page. For example, the admin wants to offer 10% off on the 1st purchase of his new newsletter subscribers, he can send the custom coupon codes directly to them through Email or some other channel. The subscribers can use the received coupon code after adding the products to the cart and apply the code under the “Apply Discount Code” box. Success message is shown if the entered coupon code is valid and meets the defined condition.