diff --git a/modules/ppcp-subscription/src/SubscriptionModule.php b/modules/ppcp-subscription/src/SubscriptionModule.php index 5121632ef..00ecc4cc1 100644 --- a/modules/ppcp-subscription/src/SubscriptionModule.php +++ b/modules/ppcp-subscription/src/SubscriptionModule.php @@ -189,39 +189,6 @@ class SubscriptionModule implements ModuleInterface { 12 ); - add_action( - 'add_meta_boxes', - function( string $post_type ) use ( $c ) { - if ( $post_type === 'product' ) { - // phpcs:ignore WordPress.Security.NonceVerification.Recommended - $post_id = wc_clean( wp_unslash( $_GET['post'] ?? '' ) ); - $product = wc_get_product( $post_id ); - if ( is_a( $product, WC_Product_Subscription::class ) ) { - $settings = $c->get( 'wcgateway.settings' ); - assert( $settings instanceof Settings ); - if ( $settings->get( 'subscriptions_mode' ) && $settings->get( 'subscriptions_mode' ) === 'subscriptions_api' ) { - $subscription_product = $product->get_meta( 'ppcp_subscription_product' ); - $subscription_plan = $product->get_meta( 'ppcp_subscription_plan' ); - add_meta_box( - 'ppcp_subscription', - __( 'PayPal Subscription', 'woocommerce-paypal-payments' ), - function () use ( $subscription_product, $subscription_plan ) { - echo ''; - if ( $subscription_product && $subscription_plan ) { - echo '
Product ID: ' . esc_attr( $subscription_product['id'] ?? '' ) . '
'; - echo 'Plan ID: ' . esc_attr( $subscription_plan['id'] ?? '' ) . '
'; - } - }, - $post_type, - 'side', - 'high' - ); - } - } - } - } - ); - add_filter( 'woocommerce_order_data_store_cpt_get_orders_query', function( $query, $query_vars ) { @@ -298,8 +265,16 @@ class SubscriptionModule implements ModuleInterface { echo ' '; + + $subscription_product = $product->get_meta( 'ppcp_subscription_product' ); + $subscription_plan = $product->get_meta( 'ppcp_subscription_plan' ); + if($subscription_product && $subscription_plan) { + echo ''; + echo ''; + } else { + echo ''; + } + echo ''; } } catch ( NotFoundException $exception ) {