php - “Get product X for free on orders over $100” coupon code in WooCommerce -
is there simple way or plugin around allows create coupon code following kind of offer: "get product x free on orders on $100"?
yes possible additional plugin: commercial version of woocommerce extended coupon features.
- in woocommerce coupons settings have minimum field orders amount:
the free version of plugin has auto coupons functionality, allow coupons automatically added users cart if it's restrictions met. above
with inexpensive commercial version of plugin have missing functionality need: adding free products customer's cart based on coupon rules.
so 3 functionalities, conditions met auto add coupon code "get product x free on orders on $100".
additional tricks woocommerce coupons
1) woothemes snippet: create coupon programmatically
2) auto apply discount coupon customer’s purchase:
function order_price_is_greater_than_100() { global $woocommerce, $total_qty; if ( $woocommerce->cart->has_discount( $coupon_code ) ) return; if ( $woocommerce->cart->get_cart_total() >= 100 ) { $coupon_code = 'uniquecode'; // <= set name of coupon code here if (!$woocommerce->cart->add_discount( sanitize_text_field( $coupon_code ))) { $woocommerce->show_messages(); } echo '<div class="woocommerce_message"><strong>the total price in cart greater 100: … </strong></div>'; } } add_action('woocommerce_before_cart_table', 'order_price_is_greater_than_100', 10, 0);
Comments
Post a Comment