“Get product X for free on orders over $100” coupon code in WooCommerce

Is there any simple way or any plugin around that allows to create a coupon code for the following kind of offer: “get product X for free on orders over $100”?

Related posts

Leave a Reply

1 comment

  1. Yes this is possible with an additional plugin: The commercial version of WooCommerce Extended Coupon Features.

    • In WooCommerce coupons settings you have already a minimum field for orders amount:

    Minimun amount spend

    So with that 3 functionalities, the conditions are met to auto add a coupon code for “get product X for free on orders over $100”.


    Additional tricks about woocommerce coupons

    1) WooThemes snippet: Create a coupon programmatically

    2) Auto apply Discount Coupon to 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 the name of your 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 your cart is greater than 100: You get … </strong></div>';
    
        }
    }
    add_action('woocommerce_before_cart_table', 'order_price_is_greater_than_100', 10, 0);