Woocommerce Dynamic Pricing – show amount saved in cart


I would like you to help me with this problem, I am working with Woocommerce Dynamic Pricing and everything is going well, the problem is that the client wants to show how much a client has saved below the sub-total, all good until there, the problem is The discount given by dynamic pricing does not call me, instead it calls me the sale price, which is the normal woocommerce discount, I am using this code which is the one that has shown me the discount best:

function wc_discount_total() {
   global $woocommerce;
    $discount_total = 0;
      
    foreach ( $woocommerce->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 = ($regular_price - $sale_price) * $values('quantity');
        $discount_total += $discount;
        }
    }        
    if ( $discount_total > 0 ) {
    echo '<tr class="cart-discount">
    <th>'. __( 'Your Savings', 'woocommerce' ) .'</th>
    <td data-title=" '. __( 'You Saved', 'woocommerce' ) .' ">'
    . wc_price( $discount_total + $woocommerce->cart->discount_cart ) .'</td>
    </tr>';
    }
}
add_action( 'woocommerce_cart_totals_before_shipping', 'wc_discount_total', 99);
add_action( 'woocommerce_cart_totals_before_shipping', 'wc_discount_total', 99);

the problem is in this line: “$sale_price = $_product->get_sale_price();” this calling is the woocommerce discount price and not the discount price that dynamic pricing gives, could you help me since I have more than 5 days trying to find the code and I could not!