Ordinarily, WooCommerce does not display the sale price on the cart page for some reason. It does do so on the checkout page.
To display this in Shoptimizer, it’s a two step process.
First, add the following function to your child theme’s functions.php file, or via the Code Snippets plugin. Thanks to Business Bloomer for this tip.
1 2 3 4 5 6 7 8 9 10 |
add_filter( 'woocommerce_cart_item_price', 'cg_cart_table_price_display', 30, 3 ); function cg_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; } |
Next, add the following CSS snippet – either in your child theme’s style.css file, or via:
Appearance > Customize > Additional CSS
.
1 2 3 4 5 6 7 8 |
#page table.cart.woocommerce-cart-form__contents td.product-price { display: table-cell; } #page table.cart.woocommerce-cart-form__contents td.product-price del { opacity: 0.5; font-size: 13px; margin-right: 3px; } |