Repository Forums Support WooCommerce Extended Coupon Features PRO Regular and Sale price in the Cart. Reply To: Regular and Sale price in the Cart.

#1436
Soft79
Keymaster

Yes, this can be done using the following snippet in functions.php.

But:
– The snippet does not respect the tax display settings of WooCommerce
– The subtotal below the cart will still display the undiscounted subtotal


add_filter( 'woocommerce_cart_item_subtotal',
  function( $price, $values ) {
    if ( ! isset( $values['line_subtotal'], $values['line_total'] ) ) return $price;

    $regular_price = $values['line_subtotal'] + $values['line_subtotal_tax'];
    $sale_price = $values['line_total'] + $values['line_tax'];

    $price = '<del>' . ( is_numeric( $regular_price ) ? wc_price( $regular_price ) : $regular_price ) . '</del> <ins>' . ( is_numeric( $sale_price ) ? wc_price( $sale_price ) : $sale_price ) . '</ins>';
		
    return $price;
  },
10, 2);