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

Differentiate between Woo checkout and PayPal review page, PFW-452 #1350

Merged
merged 1 commit into from
Aug 23, 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
25 changes: 25 additions & 0 deletions angelleye-includes/angelleye-conditional-functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

defined('ABSPATH') || exit;

if (!function_exists('is_angelleye_ec_review_page')) {

/**
* is_angelleye_ec_review_page - Returns true when viewing the Express Checkout order review page.
*
* @return bool
*/
function is_angelleye_ec_review_page() {
if (!class_exists('WooCommerce') || WC()->session == null) {
return false;
}
$paypal_express_checkout = WC()->session->get('paypal_express_checkout');
if (isset($paypal_express_checkout['token']) && !empty($paypal_express_checkout['token']) && isset($paypal_express_checkout['payer_id']) && !empty($paypal_express_checkout['payer_id'])) {
return true;
} else {
return false;
}
}

}

2 changes: 1 addition & 1 deletion paypal-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
if (!function_exists('angelleye_queue_update')) {
require_once( 'angelleye-includes/angelleye-functions.php' );
}

require_once( 'angelleye-includes/angelleye-conditional-functions.php' );
/**
* Set global parameters
*/
Expand Down