Preventing the legacy coupons page from being readded when the naviga… (https://github.com/woocommerce/woocommerce-admin/pull/5307)
* Preventing the legacy coupons page from being readded when the navigation plugin is active (woocommerce/navigation woocommerce/woocommerce-admin#122) I've also added a check to prevent the "coupons page has moved" note from being displayed, since it's no longer applicable in the new nav. * Addressing linting issues with PHP files * Updating conditions to work correctly with navigation as feature instead of external plugin * Updating comment text
This commit is contained in:
parent
4dd0232c44
commit
b2e5d32db9
|
@ -5,6 +5,8 @@
|
|||
|
||||
namespace Automattic\WooCommerce\Admin\Features;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Loader;
|
||||
|
||||
/**
|
||||
* CouponsMovedTrait trait.
|
||||
*/
|
||||
|
@ -88,7 +90,7 @@ trait CouponsMovedTrait {
|
|||
* @return bool
|
||||
*/
|
||||
protected static function should_display_legacy_menu() {
|
||||
return (bool) get_option( self::$option_key, 1 );
|
||||
return ( get_option( self::$option_key, 1 ) && ! Loader::is_feature_enabled( 'navigation' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
namespace Automattic\WooCommerce\Admin\Notes;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\CouponsMovedTrait;
|
||||
use Automattic\WooCommerce\Admin\Loader;
|
||||
use stdClass;
|
||||
use WC_Data_Store;
|
||||
|
||||
|
@ -54,6 +55,11 @@ class Coupon_Page_Moved {
|
|||
return false;
|
||||
}
|
||||
|
||||
// If new navigation feature is enabled.
|
||||
if ( Loader::is_feature_enabled( 'navigation' ) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return isset( $_GET[ self::$query_key ] ) && (bool) $_GET[ self::$query_key ]; // phpcs:ignore WordPress.Security.NonceVerification
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue