Merge pull request #1193 from woocommerce/PCP-923-ppec-compatibility-layer-does-not-take-over-subscriptions

PPEC compatibility layer does not take over subscriptions (923)
This commit is contained in:
Emili Castells 2023-02-23 17:57:35 +01:00 committed by GitHub
commit 68569c93f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 11 deletions

View file

@ -8,6 +8,7 @@
* Fix - Validate new user creation #1131
* Fix - After Updating to 2.0.2, Site Health reports REST API error #1195
* Fix - Do not send buyer-country for previews in live mode to avoid error #1186
* Fix - PPEC compatibility layer does not take over subscriptions #1193
* Enhancement - Save checkout form before free trial redirect #1135
* Enhancement - Add filter for controlling the ditching of items/breakdown #1146
* Enhancement - Add patch order data filter #1147

View file

@ -183,18 +183,19 @@ class SubscriptionsHandler {
return true;
}
if ( function_exists( 'get_current_screen' ) && get_current_screen() ) {
// Are we on the WC > Subscriptions screen?
if ( 'edit-shop_subscription' === get_current_screen()->id ) {
return true;
}
// Are we on the WC > Subscriptions screen?
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$post_type = wc_clean( wp_unslash( $_GET['post_type'] ?? $_POST['post_type'] ?? '' ) );
if ( $post_type === 'shop_subscription' ) {
return true;
}
// Are we editing an order or subscription tied to PPEC?
if ( in_array( get_current_screen()->id, array( 'shop_subscription', 'shop_order' ), true ) ) {
$order = wc_get_order( $GLOBALS['post']->ID );
return ( $order && PPECHelper::PPEC_GATEWAY_ID === $order->get_payment_method() );
}
// Are we editing an order or subscription tied to PPEC?
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$order_id = wc_clean( wp_unslash( $_GET['post'] ?? $_POST['post_ID'] ?? '' ) );
if ( $order_id ) {
$order = wc_get_order( $order_id );
return ( $order && PPECHelper::PPEC_GATEWAY_ID === $order->get_payment_method() );
}
return false;

View file

@ -89,6 +89,7 @@ Follow the steps below to connect the plugin to your PayPal account:
* Fix - Validate new user creation #1131
* Fix - After Updating to 2.0.2, Site Health reports REST API error #1195
* Fix - Do not send buyer-country for previews in live mode to avoid error #1186
* Fix - PPEC compatibility layer does not take over subscriptions #1193
* Enhancement - Save checkout form before free trial redirect #1135
* Enhancement - Add filter for controlling the ditching of items/breakdown #1146
* Enhancement - Add patch order data filter #1147