Mailchimp Banner | Q2 2024

added by Latoya

Product Icon

WooCommerce Points and Rewards

by  Woo
Reward your customers for purchases and other actions with points which can be redeemed for discounts.

Points Redemption Option for Sale Items

I would love a way to automatically remove points redemption on checkout for any items that are on sale.

Author

Current Status

Open

Last updated: April 17, 2018

2 comments

Log in to comment on this feature request.

  1. Hanna Partridge says:

    I really need this before our black friday is it possible to put code here to block points redemption on sale items?

  2. baltoxyz says:

    Absolutely this should be an option, it’s amazing how this idea is three years old now.
    Customers should not be able to apply points to products that are already on sale

    EDIT: Include this on your functions.php file to use original price instead of sale price when redeeming points:

    //do not apply fixed price coupon when product is on sale
    add_action( ‘woocommerce_before_calculate_totals’, ‘adjust_cart_coupon’, 10, 1);
    function adjust_cart_coupon( $cart_object) {
    global $woocommerce;

    if ( is_admin() && ! defined( ‘DOING_AJAX’ ) ){
    return;
    }

    $coupon = False;

    if ($coupons = WC()->cart->get_applied_coupons() == False ) {
    $coupon = False;
    } else {
    foreach ( WC()->cart->get_applied_coupons() as $code ) {
    $coupons1 = new WC_Coupon( $code );
    if ($coupons1->type == ‘fixed_cart’){
    $coupon = True;
    }
    }
    }

    if ($coupon == True){
    foreach ( $cart_object->get_cart() as $cart_item ){
    $price = $cart_item[‘data’]->regular_price;
    //sets cart item to use regular price and not sale price
    $cart_item[‘data’]->set_price( $price );
    }
    }
    }