pronamic / wp-pronamic-pay-woocommerce

WooCommerce driver for the WordPress payment processing library.

Home Page:http://www.wp-pay.org/extensions/woocommerce/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pronamic Pay subscription meta box no longer visible?

remcotolsma opened this issue · comments

if ( \is_admin() ) {
\add_action( 'add_meta_boxes', [ $this, 'maybe_add_pronamic_pay_meta_box_to_wc_subscription' ], 10, 2 );
}

/**
* Maybe add a Pronamic Pay meta box the WooCommerce subscription.
*
* @link https://github.com/pronamic/wp-pronamic-pay-woocommerce/issues/41
* @link https://developer.wordpress.org/reference/hooks/add_meta_boxes/
* @param string $post_type_or_screen_id Post type or screen ID.
* @param WC_Order|WP_Post $post_or_order_object Post or order object.
* @return void
*/
public function maybe_add_pronamic_pay_meta_box_to_wc_subscription( $post_type_or_screen_id, $post_or_order_object ) {
if ( ! \in_array( $post_type_or_screen_id, [ 'shop_order', 'woocommerce_page_wc-orders--shop_subscription' ], true ) ) {
return;
}
$subscription = $post_or_order_object instanceof WC_Subscription ? $post_or_order_object : \wcs_get_subscription( $post_or_order_object->ID );
if ( ! $subscription instanceof WC_Subscription ) {
return;
}
\add_meta_box(
'woocommerce-subscription-pronamic-pay',
\__( 'Pronamic Pay', 'pronamic_ideal' ),
function () use ( $subscription ) {
include __DIR__ . '/../views/admin-meta-box-woocommerce-subscription.php';
},
$post_type_or_screen_id,
'side',
'default'
);
}

It looks like the $post_type_or_screen_id is no longer shop_order but shop_subscription.