Home » WooCommerce: Display Regular & Sale Price @ Cart Table

WooCommerce: Display Regular & Sale Price @ Cart Table

by Tutor Aspire

In my opinion, the WooCommerce Cart table is somewhat confusing. Why isn’t the “sale price” displayed there? Well, this is a mystery!

I’m pretty confident that showing the “slashed” price would actually help your conversion rate.

So, what about 10 PHP lines in exchange for an increase in sales? Great! Here’s the snippet 🙂

WooCommerce: show sale prices @ Cart Table
WooCommerce: show sale prices @ Cart Table

PHP Snippet: Display Regular/Sale Price in the Cart Table @ WooCommerce Cart

/**
 * @snippet       Show Regular/Sale Price @ WooCommerce Cart Table
 * @how-to        Get tutoraspire.com FREE
 * @author        Tutor Aspire
 * @testedwith    WooCommerce 3.8
 * @donate $9     https://tutoraspire.com
 */
 
add_filter( 'woocommerce_cart_item_price', 'tutoraspire_change_cart_table_price_display', 30, 3 );
 
function tutoraspire_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;
}

You may also like