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

Express Checkout - Woo checkout validation redirects to cart page : PFW-479 #1358

Merged
merged 2 commits into from
Sep 16, 2019
Merged
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 @@ -589,23 +589,28 @@ public function ec_enqueue_scripts_product_page($is_mini_cart = false) {
return false;
}
}
$smart_cancel_page = '';
if(is_product() && $this->single_product_configure_settings) {
$this->button_layout = $this->single_product_button_layout;
$this->button_size = $this->single_product_button_size;
$this->disallowed_funding_methods = $this->single_product_disallowed_funding_methods;
$smart_cancel_page = wc_get_cart_url();
} elseif(is_cart() && $this->cart_configure_settings) {
$this->button_layout = $this->cart_button_layout;
$this->button_size = $this->cart_button_size;
$this->disallowed_funding_methods = $this->cart_disallowed_funding_methods;
$smart_cancel_page = wc_get_cart_url();
} elseif (is_checkout() && $this->checkout_page_configure_settings) {
$this->button_layout = $this->checkout_page_button_layout;
$this->button_size = $this->checkout_page_button_size;
$this->disallowed_funding_methods = $this->checkout_page_disallowed_funding_methods;
$smart_cancel_page = wc_get_checkout_url();
}
if($this->mini_cart_configure_settings == false) {
$this->mini_cart_button_layout = $this->button_layout;
$this->mini_cart_button_size = $this->button_size;
$this->mini_cart_disallowed_funding_methods = $this->disallowed_funding_methods;
$smart_cancel_page = wc_get_cart_url();
}
$this->mini_cart_allowed_funding_methods = $this->allowed_funding_methods;
if($this->wsc_cart_configure_settings == false) {
Expand Down Expand Up @@ -682,6 +687,7 @@ public function ec_enqueue_scripts_product_page($is_mini_cart = false) {
'wsc_cart_button_size' => $this->wsc_cart_button_size,
'button_fundingicons' => $this->button_fundingicons,
'cancel_page' => add_query_arg('pp_action', 'cancel_order', WC()->api_request_url('WC_Gateway_PayPal_Express_AngellEYE')),
'smart_cancel_page' => $smart_cancel_page,
'is_paypal_credit_enable' => $this->is_paypal_credit_enable ? "yes" : 'no',
'allowed_funding_methods' => $allowed_funding_methods_json,
'disallowed_funding_methods' => $disallowed_funding_methods_json,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ public function angelleye_redirect() {
if (wc_notice_count('error') > 0) {
if($this->save_abandoned_checkout == true) {
wp_send_json(array(
'url' => get_permalink(wc_get_page_id('cart'))
'url' => wc_get_cart_url()
));
} else {
return array(
'url' => get_permalink(wc_get_page_id('cart'))
'url' => wc_get_cart_url()
);
}
exit();
Expand All @@ -125,7 +125,7 @@ public function angelleye_redirect() {
}

} else {
wp_redirect(get_permalink(wc_get_page_id('cart')));
wp_redirect(wc_get_cart_url());
exit;
}
} else {
Expand All @@ -145,7 +145,7 @@ public function angelleye_redirect() {
} else {
$args = array(
'result' => 'failure',
'redirect' => get_permalink(wc_get_page_id('cart')),
'redirect' => wc_get_cart_url(),
);
if ($this->function_helper->ec_is_version_gte_2_4()) {
if (ob_get_length()) {
Expand Down Expand Up @@ -634,7 +634,7 @@ public function angelleye_set_express_checkout_request() {
$order = null;
$cancel_url = !empty($this->gateway->cancel_page_id) ? get_permalink($this->gateway->cancel_page_id) : wc_get_cart_url();
if ($cancel_url == false) {
$cancel_url = wc_get_cart_url();
$cancel_url = wc_get_checkout_url();
}
$cancel_url = add_query_arg('utm_nooverride', '1', $cancel_url);
$order_total = '';
Expand Down
20 changes: 10 additions & 10 deletions assets/js/angelleye-in-context-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ jQuery(function ($) {
});
},
onCancel: function (data, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
},
onClick: function () {
if (angelleye_in_content_param.enable_google_analytics_click === 'yes') {
Expand All @@ -120,7 +120,7 @@ jQuery(function ($) {
onError: function (err, actions) {
console.log("err");
if ($('.angelleye_button_single').length) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
}
}
}, '.angelleye_button_single');
Expand Down Expand Up @@ -206,7 +206,7 @@ jQuery(function ($) {
});
},
onCancel: function (data, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
},
onClick: function () {
if (angelleye_in_content_param.enable_google_analytics_click === 'yes') {
Expand All @@ -220,7 +220,7 @@ jQuery(function ($) {
}
},
onError: function (err, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
}
}, selector);
}
Expand Down Expand Up @@ -296,7 +296,7 @@ jQuery(function ($) {
});
},
onCancel: function (data, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
},
onClick: function () {
if (angelleye_in_content_param.enable_google_analytics_click === 'yes') {
Expand All @@ -310,7 +310,7 @@ jQuery(function ($) {
}
},
onError: function (err, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
}
}, selector);
}
Expand Down Expand Up @@ -383,7 +383,7 @@ jQuery(function ($) {
});
},
onCancel: function (data, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
},
onClick: function () {
if (angelleye_in_content_param.enable_google_analytics_click === 'yes') {
Expand All @@ -397,7 +397,7 @@ jQuery(function ($) {
}
},
onError: function (err, actions) {
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
}
}, selector);
}
Expand Down Expand Up @@ -477,7 +477,7 @@ jQuery(function ($) {
},
onCancel: function (data, actions) {
$('.woocommerce').unblock();
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
},
onClick: function () {
if (angelleye_in_content_param.enable_google_analytics_click === 'yes') {
Expand All @@ -492,7 +492,7 @@ jQuery(function ($) {
},
onError: function (err, actions) {
$('.woocommerce').unblock();
window.location.href = angelleye_in_content_param.cancel_page;
window.location.href = angelleye_in_content_param.smart_cancel_page;
}
}, selector);
}
Expand Down
Loading