Automattic\WooCommerce\Internal\Admin

ShippingLabelBanner::add_print_shipping_label_script()publicWC 1.0

Adds JS to order page to render shipping banner.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$ShippingLabelBanner = new ShippingLabelBanner();
$ShippingLabelBanner->add_print_shipping_label_script( $hook );
$hook(строка) (обязательный)
current page hook.

Код ShippingLabelBanner::add_print_shipping_label_script() WC 8.9.0

public function add_print_shipping_label_script( $hook ) {
	WCAdminAssets::register_style( 'print-shipping-label-banner', 'style', array( 'wp-components' ) );
	WCAdminAssets::register_script( 'wp-admin-scripts', 'print-shipping-label-banner', true );

	$payload = array(
		'nonce'                 => wp_create_nonce( 'wp_rest' ),
		'baseURL'               => get_rest_url(),
		'wcs_server_connection' => true,
	);

	wp_localize_script( 'print-shipping-label-banner', 'wcConnectData', $payload );
}