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

Topic Resolution: Resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1431
    cams
    Participant

    Is it possible to show regular and sale price in the cart with autocupons?

    like this: https://businessbloomer.com/wp-content/uploads/2016/05/woocommerce-display-regular-sale-price-cart-table.png

    Thanks in advance.

    ***

    Es posible que este plugin muestre el precio normal y el precio rebajado con cupones automáticos?

    Me refiero a esto: https://businessbloomer.com/wp-content/uploads/2016/05/woocommerce-display-regular-sale-price-cart-table.png

    Muchas gracias!

    #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);
    
    #1447
    cams
    Participant

    Really thanks!

    #18070
    Smadar Israel
    Participant

    That code is perfect!
    Do you have a snippet for catalog page & product page?
    I need to show original and sale price

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.