get_cart_items_discount( $cart ); } add_action( 'woocommerce_before_calculate_totals', 'disco_set_cart_item_price_test', 1, 1 ); } if ( ! function_exists( 'disco_cart_item_price_html' ) ) { /** * Display Cart Item Sale Price & Regular Price html * * @param \WC_Cart $cart Cart Object. */ function disco_cart_item_price_html( $cart ) { $page_name = Disco::get_page_name(); foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) { if ( ! isset( $cart_item['data'] ) || ! is_a( $cart_item['data'], 'WC_Product' ) ) { continue; } $product = $cart_item['data']; // remove strike-through based on page name if ( Disco::is_strike_through_applicable( $page_name ) ) { continue; } $product->set_regular_price( '' ); } } add_action( 'woocommerce_before_calculate_totals', 'disco_cart_item_price_html', PHP_INT_MAX, 1 ); }