Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redirect express delivery address not editable #73

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,19 @@ 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 ) ) {
$body['order']['shipping_option'] = $shipping_option;
}

// 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'] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down