Store shipping cost in the DTO

This commit is contained in:
Philipp Stracker 2024-08-13 19:31:51 +02:00
parent 611ab4c5a7
commit 3b92eaac81
No known key found for this signature in database
6 changed files with 30 additions and 7 deletions

View file

@ -85,7 +85,8 @@ class SimulateCartEndpoint extends AbstractCartEndpoint {
$this->add_products( $products );
$this->cart->calculate_totals();
$total = (float) $this->cart->get_total( 'numeric' );
$total = (float) $this->cart->get_total( 'numeric' );
$shipping_fee = (float) $this->cart->get_shipping_total();
$this->restore_real_cart();
@ -113,7 +114,7 @@ class SimulateCartEndpoint extends AbstractCartEndpoint {
wp_send_json_success(
array(
'total' => $total,
'total_str' => ( new Money( $total, $currency_code ) )->value_str(),
'shipping_fee' => $shipping_fee,
'currency_code' => $currency_code,
'country_code' => $shop_country_code,
'funding' => array(