WC_Product_Usage_Notice::enqueue_product_usage_notice_scripts()
Enqueue scripts needed to display product usage notice (or modal).
Метод класса: WC_Product_Usage_Notice{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WC_Product_Usage_Notice::enqueue_product_usage_notice_scripts();
Код WC_Product_Usage_Notice::enqueue_product_usage_notice_scripts() WC Product Usage Notice::enqueue product usage notice scripts WC 9.4.2
public static function enqueue_product_usage_notice_scripts() { WCAdminAssets::register_style( 'woo-product-usage-notice', 'style', array( 'wp-components' ) ); WCAdminAssets::register_script( 'wp-admin-scripts', 'woo-product-usage-notice', true ); $subscribe_url = add_query_arg( array( 'add-to-cart' => self::$current_notice_rule['id'], 'utm_source' => 'pu', 'utm_medium' => 'product', 'utm_campaign' => 'pu_modal_subscribe', ), 'https://woocommerce.com/cart/' ); $renew_url = add_query_arg( array( 'renew_product' => self::$current_notice_rule['id'], 'product_key' => self::$current_notice_rule['state']['key'], 'order_id' => self::$current_notice_rule['state']['order_id'], 'utm_source' => 'pu', 'utm_medium' => 'product', 'utm_campaign' => 'pu_modal_renew', ), 'https://woocommerce.com/cart/' ); wp_localize_script( 'wc-admin-woo-product-usage-notice', 'wooProductUsageNotice', array( 'subscribeUrl' => $subscribe_url, 'renewUrl' => $renew_url, 'dismissAction' => 'woocommerce_dismiss_product_usage_notice', 'remindLaterAction' => 'woocommerce_remind_later_product_usage_notice', 'productId' => self::$current_notice_rule['id'], 'productName' => self::$current_notice_rule['name'], 'productRegularPrice' => self::$current_notice_rule['regular_price'], 'dismissNonce' => wp_create_nonce( 'dismiss_product_usage_notice' ), 'remindLaterNonce' => wp_create_nonce( 'remind_later_product_usage_notice' ), 'showAs' => self::$current_notice_rule['show_as'], 'colorScheme' => self::$current_notice_rule['color_scheme'], 'subscriptionState' => self::$current_notice_rule['state'], 'screenId' => get_current_screen()->id, ) ); }