Documentation/Smart Coupons for WooCommerce/How to restrict auto apply coupons in WooCommerce

How to restrict auto apply coupons in WooCommerce

To apply coupon automatically in WooCommerce is one of the most convenient feature that lets your customers to avail discount soon after the products are moved to cart.  With the auto apply coupon, customer needn’t have to manually enter the code, if found eligible for the coupon, it is automatically applied into their cart.

An advanced coupon extension plugin Smart Coupons for WooCommerce can be used to auto-add coupons in your WooCommerce. This plugin will help you to redeem coupons automatically once the discount conditions and cart conditions are matched. 

Another peculiar advantage of this plugin is that, its not just one or two, you can set five coupons to get applied automatically.

Let us go through some of the benefits of this auto coupon apply feature:

  • No need to enter the code manually
  • Removes copy-paste errors
  • Needn’t have to remember the code
  • Surprise and delighted customers

How to redeem coupons automatically?

First of all,  install and set up the extension plugin Smart Coupons for WooCommerce. Then, follow the given steps:

Create an auto-coupon

Let’s take a simple example, Ex: 10% discount

  1. Go to WooCommerce > Coupons from your dashboard.
  2. From the Coupons window, click on the Add Coupon button.
  3. From General panel configure the Discount type and Coupon amount
  4. Enable Apply coupon automatically option in General panel
  5. Then, Publish the coupon
Auto Apply Coupon in WooCommerce

Auto Apply Coupon in WooCommerce

This simple coupon can be automatically redeemed every time from the cart because it has no other conditions to satisfy.

But, one major factor to be taken into account while configuring huge amount of auto apply coupon in your store is the server capacity. When considerable amount of coupons are configured for auto apply feature, the plugin will check for the eligibility of all these coupon whenever a customer moves his products into the cart. This may result in high memory usage and thereby slowing down of your site. However, the plugin has effectively dealt with this case by considering only the latest 5 (recently published) for applying automatically.

Now that, if your server is fully equipped to handle any number of coupons or if you feel like instead of 5, you need to set at least 10 coupons for auto apply, then just simply use the below given filter in the active child theme’s functions.php.

add_filter( ‘wt_smartcoupon_max_auto_coupons_limit’, function( ) { return 10; } );

The above filter will allow you to have a maximum of 10 coupons (recently published) for auto apply option. Replace the number 10 from the code and insert the required number to have as many auto apply coupons for your store. The plugin restricts the coupons from applying automatically to a maximum count of five only to facilitate uninterrupted workflow for your store. By asserting this restriction, the slowness caused due to unnecessary memory usage for verifying the coupon eligibility can be reduced considerably.

To know the different ways in which the coupons can be made applied automatically, refer here.

  • Was this article helpful?
  • YesNo