Repository › Forums › Support › WooCommerce Extended Coupon Features PRO › Add a coupon that adds a coupon
- This topic has 3 replies, 2 voices, and was last updated 6 years, 2 months ago by Soft79.
-
AuthorPosts
-
July 21, 2017 at 6:02 am #1694Jonathan MooreParticipant
I want to add a coupon that adds a coupon – any ideas for implementation?
Example Scenario:
When users add 2 widgets to the basket, prompt them that if they add more they qualify for the free offer.Example implementation:
Coupon1: auto add after 2 widgets are added, add a free product which is in fact the coupon “special offer for 4 widgets”
Coupon2: “special offer for 4 widgets” – with eligibility rule of 4 widgets, allow applying when invalid and message “add more widgets for our special offer… ” etcEssentially what we are looking for is two levels of rules, an encouragement level and an eligibility level.
Another example – free shipping over $150, start encouraging customers once the basket is over $100.
Rule 1: basket over $100, auto-add the free shipping coupon, although it is not yet eligible, so it will start giving the prompt messages
Rule 2: basket over $150, free shippingIt doesn’t make sense to implement multiple rule sets on the coupon, that’s complex, so the rules could be different coupons which are chained, using the “free product” or similar feature… could the free product be the next coupon?
One solution is to have a product type which is a coupon/auto-issues a coupon and link it that way.
Note, It can’t be a coupon which has elibility rule for the special product type “coupon” since the elegibility rule needs different (eg the criteria in the examples above, >4 widgets, basket over $150 etc)Thoughts?
July 21, 2017 at 8:23 am #1695Soft79KeymasterThat is not possible with the plugin.
Instead of creating Coupon1, it’s fairly easy (for a developer) to create a PHP script for this. More or less like this: (psuedo code)
if ($number_of_widgets >=2 and $number_of_widgets < 4) { echo ('please add ' . 4 - $number_of_widgets . ' widgets for a great offer! ); }
Implement this in strategical positions of the theme (e.g. using actions)
July 21, 2017 at 9:09 am #1697Jonathan MooreParticipantYes I already do some of this.
but this sort of hard-coded stuff would very easily get out of date with changes to coupons made by the shop manager.Actually I think it should be quite easy to do some sort of enhancement with the plugin. I mean it seems crazy to write extra code to auto-add a coupon when the auto-add coupons already has all the logic for this.
For the theme code, instead of echo, use wc_add_notice() for a separate message, or simply implement as:
function my_check_offers($message, $products )
{
//check products added and add new coupons or messages
return $message;
}
add_filter( ‘wc_add_to_cart_message_html’, ‘my_check_offers’, 10, 2);July 21, 2017 at 9:42 am #1698Soft79KeymasterWell, unfortunately I have no plans to implement this functionality.
-
AuthorPosts
- You must be logged in to reply to this topic.