Automattic\WooCommerce\Internal\Admin

Coupons::maybe_add_marketing_coupon_script()publicWC 1.0

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

Метод класса: Coupons{}

Хуков нет.

Возвращает

null. Ничего.

Использование

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

Код Coupons::maybe_add_marketing_coupon_script() WC 7.3.0

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