woocommerce_interactivity_register_runtime()WC 1.0

Register the Interactivity API runtime and make it available to be enqueued as a dependency in interactive blocks.

Хуков нет.

Возвращает

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

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

woocommerce_interactivity_register_runtime();

Код woocommerce_interactivity_register_runtime() WC 9.5.1

function woocommerce_interactivity_register_runtime() {
	$plugin_path = \Automattic\WooCommerce\Blocks\Package::get_path();
	$plugin_url  = plugin_dir_url( $plugin_path . '/index.php' );

	$file = 'assets/client/blocks/wc-interactivity.js';

	$file_path = $plugin_path . $file;
	$file_url  = $plugin_url . $file;

	if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && file_exists( $file_path ) ) {
		$version = filemtime( $file_path );
	} else {
		// Use wc- prefix here to prevent collisions when WC Core version catches up to a version previously used by the WC Blocks feature plugin.
		$version = 'wc-' . Constants::get_constant( 'WC_VERSION' );
	}

	wp_register_script(
		'wc-interactivity',
		$file_url,
		array(),
		$version,
		true
	);
}