“WooCommerce Extended Coupon Features” is an easy-to-use WordPress / WooCommerce plugin that adds functionality to the WooCommerce coupon system.
The functionality is conveniently integrated to the standard WooCommerce Edit Coupon panel therefore the plugin is extremely easy to use.
What can be achieved with this plugin?
The following three tabs will be added when the plugin is enabled:
WooCommerce Extended Coupon Features adds extra features to the 'Usage restriction'-tab of the coupon edit page. Here extra rules can be configured that work in combination with the Products, Exclude products, Product categories and Exclude categories rules.
By default a coupon validates if only one of the selected products is in the cart. Check this box if ALL of the products entered on the 'Usage Restriction'-tab must be in the cart to validate the coupon. The word 'OR' or 'AND' is displayed next to the 'Products'-field on the 'Usage Restriction'-tab for clarification.
By default a coupon validates if a product from any of the selected categories is in the cart. Check this box if products from ALL of the categories entered on the 'Usage Restriction'-tab must be in the cart to validate the coupon. The word 'OR' or 'AND' is displayed next to the 'Products'-field on the 'Usage Restriction'-tab for clarification.
The coupon will only validate if the number of products matching the product or category restrictions (on the 'Usage Restriction'-tab in the cart is within this range. If no product or category restriction is entered, the total quantity of all of the products in the cart will be used.
The coupon will only validate if the total value of the products matching the product or category restrictions (on the 'Usage Restriction'-tab in the cart is within this range. If no product or category restriction is entered, the total value of all of the products in the cart will be used.
Please note: The difference between this option and the 'minimum/maximum spend' on the 'General'-tab is that on the general tab the subtotal of all of the items in the cart is compared.
This option is only visible if the discount type is Cart Discount or Cart % Discount.
By default, When the coupon is setup as a 'Cart Discount' it will never validate a coupon when an excluded product is in the cart (this is how WooCommerce Coupons work). By checking this box the coupon will still validate when an excluded product is in the cart. Useful for cart discounts based on a subtotal of matching products, but having some products or categories excluded.
(PRO Version Only)
On the 'Products'-tab
In the 'Free products'-field on the 'Free products'-tab you can enter one or more products that will automatically be added to the cart when the coupon is applied. The product will automatically be removed when the coupon is no longer valid.
If you tick the 'select one'-checkbox, the customer must choose one (or more) of the selected products on the cart or checkout page. The customer can also choose the desired variations of a variable product. You can also edit the message that is displayed.
If you wish to change the look-and-feel of the product selection you must create a subdirectory woocommerce-auto-added-coupons-pro in your themes directory and copy and edit the files templates/cart/select-free-product.php and templates/checkout/select-free-product.php in here.
When the box 'Allow multiplication of the free products' is checked the amount of free products will be multiplied every time the minimum spend, subtotal or quantity is reached. For example if the minimum spend is $ 50 and the user has $ 160 worth of products in the cart, the free products will be added 3 times to the cart.
On the checkout-tab restrictions can be entered that will normally only be active when the customer initiates checkout.
The coupon will only validate if the customer selects one of these shipping methods.
The coupon will only validate if the customer selects one of these payment methods.
When you enter one or more customers here, the coupon will only validate if the customer is logged in and is in this list.
When you enter one or more user roles here, the coupon will only validate if the customer has one of these user roles (e.g. Wholesale buyer or Guest).
The coupon will only validate if the customer does not have any of these user roles (e.g. Wholesale buyer or Guest).
You can convert a coupon into a discount rule simply by ticking the "Auto coupon" checkbox on the 'miscellaneous'-tab. When using this option it is important to enter a description for the coupon, as this will be presented to the customer.
When this option is activated, the discount will automatically be applied to the cart when it's conditions are met and the description will be presented to the customer and on the cart page. Once the conditions are no longer met, for example when the customer removes an item from the cart, the discount will be removed from the cart.
When this box is checked, no 'Discount applied' notice will be presented when the coupon is applied.
(PRO Version Only)
When the box 'Allow applying when invalid' is ticked, a customer can always add the coupon to the cart, but will be presented with a message that the discount will only apply when the conditions are met.
NOTE: This option is not available for 'Auto coupons'.
Now you can easily create a link that will automatically apply a coupon to the user's cart, optionally in combination with a product.
Simply append ?apply_coupon=coupon_code to the url. If you also want to add products to the cart with the same url, you can use add-to-cart=product_id and optionally a quantity. You can find the id of a product on the WooCommerce Edit-page of the product.
Example:
http://www.your-store.nl/cart/?add-to-cart=4321&quantity=3&apply_coupon=my_coupon
If the customer opens the url when the conditions of the coupon are not yet met or the cart is empty the coupon won't be applied yet, instead the following message will be displayed: Coupon will be applied once it's conditions are met. Once the conditions of the coupon are met it will be applied automatically.
(PRO Version Only)
NOTE: This is only possible if you purchased the plugin at soft79.nl.
Go to: wp-admin > Settings > WooCommerce Extended Coupon Features
Enter the domain and licence key. The licence will be automatically activated.
To deactivate a licence key for a domain (e.g. to move it to a different domain) just empty the fields and save the settings. The licence will automatically be deactivated for the domain and can be used on a different domain.
You can also manage you licence activations from your account page at soft79.nl.
You can further extend functionality of WooCommerce Extended Coupon Features by creating your own mini-plugins.
Hook into the wjecf_init_plugins-action. (Using this hook guarantees that the WooCommerce and WooCommerce Extended Coupon Features plugins are loaded)
Here, create a class that extends Abstract_WJECF_Plugin.
Create a constructor, where you setup the plugin data by calling $this->set_plugin_data
Create a function init_hook(), where you setup your plugin and define frontend hooks.
Create a function init_admin_hook(), where you setup your plugin for admin usage and define admin hooks.
(Version 2.5.1+ only) Create a a function admin_coupon_meta_fields( $coupon ), and have it return an array [ 'field_name' => 'sanitation', ... ] .
Upon saving a coupon, these fields will be automatically read from $_POST and sanitized with the given sanition method, e.g. 'int', 'int[]', 'yesno', 'decimal', 'clean' or even a callback: [ 'callback' => callback ] and saved to the current coupon. For versions prior to 2.5.1, you need to handle process_shop_coupon_meta yourself.
Load the class by calling WJECF()->add_plugin( 'NameOfYourClass');
<?php /** Plugin Name: WJECF Example plugin - Allow a coupon on certain weekdays only Description: An example on how to extend WooCommerce Extended Coupon Features Author: Soft79 Version: 1.0 Author URI: http://www.soft79.nl/ */ add_action( 'wjecf_init_plugins', 'setup_my_wjecf_example_plugin' ); function setup_my_wjecf_example_plugin() { class WJECF_Plugin_Example extends Abstract_WJECF_Plugin { //This is the meta-key where the weekday will be saved //HINT: Prepend it with _wjecf_<your plugin name> to avoid naming conflicts const META_KEY_WEEKDAY = '_wjecf_example_plugin_weekday'; /** * In the constructor you can supply general information about your WJECF-plugin. */ public function __construct() { $this->set_plugin_data( array( 'description' => __( 'WJECF Example plugin - Accept a coupon on certain weekdays only.', 'your-text-domain' ), 'dependencies' => array(), 'minimal_wjecf_version' => '2.5.1', 'can_be_disabled' => true ) ); } //FRONTEND /** * This function is called when WooCommerce and all other plugins are loaded. * Here you can setup frontend hooks. */ public function init_hook() { add_action( 'woocommerce_coupon_is_valid', array( $this, 'filter_woocommerce_coupon_is_valid' ), 10, 2 ); } /** * Invalidates the coupon if the weekday is not ok * @param bool $valid * @param WC_Coupon $coupon * @return bool False if invalid */ public function filter_woocommerce_coupon_is_valid( $valid, $coupon ) { if ( is_callable( array( $coupon, 'get_meta' ) ) ) { //WC3.0+ $coupon_weekday = $coupon->get_meta( self::META_KEY_WEEKDAY ); } else { //Older WC versions $coupon_weekday = get_post_meta( $coupon->id, self::META_KEY_WEEKDAY, true ); } //Not valid if the weekday differs if ( is_numeric( $coupon_weekday ) && date('w') != $coupon_weekday ) { return false; } return $valid; } //ADMIN /** * This function is called when WooCommerce and all other plugins are loaded and we are on the admin section of WordPress. * Here you can setup admin hooks. */ public function init_admin_hook() { add_action( 'woocommerce_coupon_options_usage_restriction', array( $this, 'action_woocommerce_coupon_options_usage_restriction' ), 9999 ); //9999 is at the bottom of the tab } /** * Automatically called at the process_shop_coupon_meta action (WJECF 2.5.1+ only). * * Returns an array [ meta_key => sanitizion_rule, ... ] with the meta fields that must be saved if the user clicks 'Update' on the coupon admin page. * * Valid sanitizion rules are: 'html', 'clean', 'yesno', 'decimal', 'int', 'int[]' (array of ints), 'int,' (comma separated ints) * * $_POST[meta_key] will be sanitized and automatically saved. * * @since 2.5.1 * @param WC_Coupon $coupon The coupon that will be saved * @return array An array with [ key => sanitizion_rule, ... ] */ public function admin_coupon_meta_fields( $coupon ) { return array( self::META_KEY_WEEKDAY => 'int' ); } /** * This is called when the usage restrictions tab is rendered. */ public function action_woocommerce_coupon_options_usage_restriction() { woocommerce_wp_select( array( 'id' => self::META_KEY_WEEKDAY, 'label' => __( 'Weekday', 'woocommerce-jos-autocoupon' ), 'options' => array( '' => '(Always valid)', 0 => 'Sunday', 1 => 'Monday', 2 => 'Tuesday', 3 => 'Wednesday', 4 => 'Thursday', 5 => 'Friday', 6 => 'Saturday' ), 'description' => __( 'Coupon is only valid on this weekday.', 'your-text-domain' ), 'desc_tip' => true ) ); } } //Loads the plugin! WJECF()->add_plugin( 'WJECF_Plugin_Example' ); }
The API functions are in WJECF_Pro_Api.php and can be called using WJECF_API()->function_name() .
Documentation is not yet available, but see wjecf-pro-api-example.php for reference.
Want to increase your conversion? Then purchase this plugin and start offering special deals to your customers right away!
Purchase WooCommerce Extended Coupon Features