The price still comes back as 0.
This is what I am trying to do:
add_action( 'woocommerce_review_order_after_order_total', 'show_total_discount_cart_checkout', 9999 );
function how_total_discount_cart_checkout() {
$discount_total = 0;
foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) {
$product = $values['data'];
if ( $product->is_on_sale() ) {
$regular_price = $product->get_regular_price();
//$sale_price = $product->get_sale_price();
$discount_price = apply_filters('advanced_woo_discount_rules_get_product_discount_price_from_custom_price', $price, $product, $quantity, $custom_price, $return_details, $manual_request, $is_cart);
$discount = ( (float)$regular_price - (float)$discount_price * (int)$values['quantity']) ;
$discount_total += $discount;
// }
}
if ( $discount_total > 0 ) {
echo '<tr><th>You Saved</th><td data-title="You Saved">' . wc_price( $discount_total + WC()->cart->get_discount_total() ) .'</td></tr>';
}
}
I tried $discount_price = apply_filters(‘advanced_woo_discount_rules_get_product_discount_price_from_custom_price’, $price, $product, $quantity, $custom_price, $return_details, $manual_request, $is_cart); on its own and still returns 0.
-
This reply was modified 2 years ago by Bert O.