Automattic\WooCommerce\Internal\Admin
Coupons::__construct
Hook into WooCommerce.
Method of the class: Coupons{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Coupons = new Coupons(); $Coupons->__construct();
Coupons::__construct() Coupons:: construct code WC 10.3.3
public function __construct() {
if ( ! is_admin() ) {
return;
}
// If the main marketing feature is disabled, don't modify coupon behavior.
if ( ! Features::is_enabled( 'marketing' ) ) {
return;
}
// Only support coupon modifications if coupons are enabled.
if ( ! wc_coupons_enabled() ) {
return;
}
add_action( 'admin_enqueue_scripts', array( $this, 'maybe_add_marketing_coupon_script' ) );
add_action( 'woocommerce_register_post_type_shop_coupon', array( $this, 'move_coupons' ) );
add_action( 'admin_head', array( $this, 'fix_coupon_menu_highlight' ), 99 );
add_action( 'admin_menu', array( $this, 'maybe_add_coupon_menu_redirect' ) );
}