WC_Products_Tracking::possibly_add_product_tracking_scripts()publicWC 1.0

Adds the tracking scripts for product filtering actions.

{} Это метод класса: WC_Products_Tracking{}

Хуков нет.

Возвращает

null. Ничего.

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

$WC_Products_Tracking = new WC_Products_Tracking();
$WC_Products_Tracking->possibly_add_product_tracking_scripts( $hook );
$hook(строка) (обязательный)
Page hook.

Код WC_Products_Tracking::possibly_add_product_tracking_scripts() WC 6.9.4

public function possibly_add_product_tracking_scripts( $hook ) {
	$product_screen = $this->get_product_screen( $hook );
	if ( ! $product_screen ) {
		return;
	}

	$script_assets_filename = WCAdminAssets::get_script_asset_filename( 'wp-admin-scripts', 'product-tracking' );
	$script_assets          = require WC_ADMIN_ABSPATH . WC_ADMIN_DIST_JS_FOLDER . 'wp-admin-scripts/' . $script_assets_filename;

	wp_enqueue_script(
		'wc-admin-product-tracking',
		WCAdminAssets::get_url( 'wp-admin-scripts/product-tracking', 'js' ),
		array_merge( array( WC_ADMIN_APP ), $script_assets ['dependencies'] ),
		WCAdminAssets::get_file_version( 'js' ),
		true
	);

	wp_localize_script(
		'wc-admin-product-tracking',
		'productScreen',
		array(
			'name' => $product_screen,
		)
	);
}