Display Regular & Sale Price on Cart Table

The WooCommerce Cart table, in my opinion, is a little unclear. Why isn’t there a display of the “selling price”? This is, after all, a puzzle!

I’m convinced that displaying the “discounted” pricing will increase your conversion rate.

add_filter( 'woocommerce_cart_item_price', 'codeithub_change_cart_table_price_display', 30, 3 );
  
function codeithub_change_cart_table_price_display( $price, $values, $cart_item_key ) {
   $slashed_price = $values['data']->get_price_html();
   $is_on_sale = $values['data']->is_on_sale();
   if ( $is_on_sale ) {
      $price = $slashed_price;
   }
   return $price;
}

Before:

Cart Table

After:

Regular Price and sales Price

Leave a Reply

Your email address will not be published. Required fields are marked *