Automattic\WooCommerce\Internal\Admin

Coupons::__construct()publicWC 1.0

Hook into WooCommerce.

Method of the class: Coupons{}

No Hooks.

Return

null. Nothing (null).

Usage

$Coupons = new Coupons();
$Coupons->__construct();

Coupons::__construct() code WC 8.7.0

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;
	}

	( new CouponPageMoved() )->init();

	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' ) );
}