Make sure woocommece-services is an allowed plugin on for shipping prompt. (https://github.com/woocommerce/woocommerce-admin/pull/4233)

This commit is contained in:
Chris Shultz 2020-04-28 07:25:11 -07:00 committed by GitHub
parent 612790227c
commit 8fa6180dee
1 changed files with 16 additions and 0 deletions

View File

@ -26,12 +26,28 @@ class ShippingLabelBanner {
* Constructor
*/
public function __construct() {
add_filter( 'woocommerce_admin_plugins_whitelist', array( $this, 'get_shipping_banner_allowed_plugins' ), 10, 2 );
if ( ! is_admin() ) {
return;
}
add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 6, 2 );
}
/**
* Gets an array of plugins that can be installed & activated via shipping label prompt.
*
* @param array $plugins Array of plugin slugs to be allowed.
*
* @return array
*/
public static function get_shipping_banner_allowed_plugins( $plugins ) {
$shipping_banner_plugins = array(
'woocommerce-services' => 'woocommerce-services/woocommerce-services.php',
);
return array_merge( $plugins, $shipping_banner_plugins );
}
/**
* Check if WooCommerce Shipping makes sense for this merchant.
*