Repository Forums Support WooCommerce Extended Coupon Features PRO Discount Type & Price prpoduct discount Reply To: Discount Type & Price prpoduct discount

#3823
Soft79
Keymaster

1. Sure, use discount type Percent. That will only apply discount to the matching products.

2. Use this snippet:


add_filter( 'woocommerce_cart_item_subtotal', function( $subtotal, $cart_item, $cart_item_key ){
    if ( $cart_item['line_total'] < $cart_item['line_subtotal'] ) {
        if ( WC()->cart->display_prices_including_tax() ) {
            $subtotal = sprintf( '<s>%s</s> %s', wc_price( $cart_item['line_subtotal'] + $cart_item['line_subtotal_tax'] ), wc_price( $cart_item['line_total'] + $cart_item['line_tax'] ) ); 
        } else {
            $subtotal = sprintf( '<s>%s</s> %s', wc_price( $cart_item['line_subtotal'] ), wc_price( $cart_item['line_total'] ) ); 
        }
    }
    return $subtotal;
}, 20, 3 );