Amit

Display Regular And Sale Price in WooCommerce Cart Table

If you want to display regular and sale price in the cart table. add the following code in the functions.php file

add_filter( 'woocommerce_cart_item_price', 'bbloomer_change_cart_table_price_display', 30, 3 );
function bbloomer_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;
}

Last Update on:March 5th, 2023 at 5:19 pm


How to create custom related products in woocommerce using functions.
Previous post