Create Custom Menu in WordPress Dashboard
Complete tutorial on create custom menu in wordpress dashboard. Discover practical examples, implementation tips, and expert advice for WordPress and WooCo
Read More โIncrease conversion rates by visually emphasizing discounts in the WooCommerce shopping cart. Use the woocommerce_cart_item_price filter to detect if a product is on sale using the is_on_sale method. Modify the price output to include the regular price wrapped in HTML <del> tags and the current sale price in <ins> tags. This transparent pricing strategy reminds customers of the value they are receiving before they proceed to checkout, reducing cart abandonment and improving the overall perceived value of your promotional offers.
To help customers understand how much they’re saving, you can show both the sale price and the regular price right in the WooCommerce cart. Here’s how to implement this using a filter. Step 1: Open the functions.php file of your current theme. Step 2: Add this PHP code snippet:
// Display regular and sale price in cart
function modify_cart_item_price($product_price, $cart_item, $cart_item_key) {
$product = $cart_item['data'];
if ($product->is_on_sale()) {
$regular_price = wc_price($product->get_regular_price());
$sale_price = wc_price($product->get_price());
$product_price = '<del>' . $regular_price . '</del> <ins>' . $sale_price . '</ins>';
}
return $product_price;
}
add_filter('woocommerce_cart_item_price', 'modify_cart_item_price', 10, 3);
Once added, WooCommerce will render a crossed-out original price followed by the sale price for every discounted item in the cart. This helps improve user experience by visually emphasizing discounts. Make sure it blends well with your theme’s design, especially if using a custom cart layout. 
Search our archives or reach out to our team for solutions and expert advice.