Automattic\WooCommerce\Internal\Admin

Coupons::maybe_add_marketing_coupon_script()publicWC 1.0

Maybe add our wc-admin coupon scripts if viewing coupon pages

Method of the class: Coupons{}

No Hooks.

Return

null. Nothing.

Usage

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

Coupons::maybe_add_marketing_coupon_script() code WC 7.1.1

public function maybe_add_marketing_coupon_script() {
	$curent_screen = PageController::get_instance()->get_current_page();
	if ( ! isset( $curent_screen['id'] ) || $curent_screen['id'] !== 'woocommerce-coupons' ) {
		return;
	}

	$rtl = is_rtl() ? '-rtl' : '';

	wp_enqueue_style(
		'wc-admin-marketing-coupons',
		WCAdminAssets::get_url( "marketing-coupons/style{$rtl}", 'css' ),
		array(),
		WCAdminAssets::get_file_version( 'css' )
	);

	WCAdminAssets::register_script( 'wp-admin-scripts', 'marketing-coupons', true );
}