From b6fecdaac2d3f964a7752f769775fe942eea13d0 Mon Sep 17 00:00:00 2001 From: Montazar Al-Jaber Date: Wed, 10 Aug 2022 20:33:15 +0200 Subject: [PATCH] Fix redirect express delivery address not editable --- .../requests/helpers/class-dintero-checkout-helper-base.php | 5 ++--- .../requests/post/class-dintero-checkout-create-session.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/classes/requests/helpers/class-dintero-checkout-helper-base.php b/classes/requests/helpers/class-dintero-checkout-helper-base.php index 69dfc08..bb77b18 100644 --- a/classes/requests/helpers/class-dintero-checkout-helper-base.php +++ b/classes/requests/helpers/class-dintero-checkout-helper-base.php @@ -41,12 +41,11 @@ public static function format_shipping_for_om( $shipping ) { * * @param array $body The request body. * @param Dintero_Checkout_Order|Dintero_Checkout_Cart $helper The helper class to use. - * @param bool $is_embedded If the request is for an embedded checkout. * @param bool $is_express If the request is for an express checkout. * @param bool $is_shipping_in_iframe If the request is for shipping selections in the iframe. * @return void */ - public static function add_shipping( &$body, $helper, $is_embedded, $is_express, $is_shipping_in_iframe ) { + public static function add_shipping( &$body, $helper, $is_express, $is_shipping_in_iframe ) { // We will always need this if shipping is available, so it will always be added. $shipping_option = $helper->get_shipping_option(); if ( ! empty( $shipping_option ) ) { @@ -54,7 +53,7 @@ public static function add_shipping( &$body, $helper, $is_embedded, $is_express, } // If its express we need to add the express options. - if ( $is_embedded && $is_express ) { + if ( $is_express ) { // If the cart does not need shipping, unset shipping, set empty array and shipping_not_required. if ( ! WC()->cart->needs_shipping() ) { unset( $body['order']['shipping_option'] ); diff --git a/classes/requests/post/class-dintero-checkout-create-session.php b/classes/requests/post/class-dintero-checkout-create-session.php index 0843aa8..9ddf3b0 100644 --- a/classes/requests/post/class-dintero-checkout-create-session.php +++ b/classes/requests/post/class-dintero-checkout-create-session.php @@ -88,11 +88,11 @@ public function get_body() { } // Set if express or not. For order-pay, we default to redirect flow. - if ( ! is_wc_endpoint_url( 'order-pay' ) && $this->is_express() && $this->is_embedded() ) { + if ( ! is_wc_endpoint_url( 'order-pay' ) && $this->is_express() ) { $this->add_express_object( $body ); } - $helper::add_shipping( $body, $helper, $this->is_embedded(), $this->is_express(), $this->is_shipping_in_iframe() ); + $helper::add_shipping( $body, $helper, $this->is_express(), $this->is_shipping_in_iframe() ); $helper::add_rounding_line( $body ); return $body;