WC_Admin_Assets::register_scriptspublicWC 1.0

Register the scripts.

These scripts are registered early to allow other plugins to take advantage of them by handle.

Method of the class: WC_Admin_Assets{}

No Hooks.

Returns

null. Nothing (null).

Usage

$WC_Admin_Assets = new WC_Admin_Assets();
$WC_Admin_Assets->register_scripts();

WC_Admin_Assets::register_scripts() code WC 10.3.3

public function register_scripts() {
	$scripts = $this->get_scripts();

	foreach ( $scripts as $script ) {
		wp_register_script(
			$script['handle'],
			$script['path'],
			$script['dependencies'] ?? array(),
			$script['version'] ?? null,
			$script['args'] ?? array( 'in_footer' => false )
		);

		if ( isset( $script['legacy_handle'] ) ) {
			wp_register_script(
				$script['legacy_handle'],
				false,
				array( $script['handle'] ),
				$script['version'] ?? null,
				true
			);
		}
	}

	wp_localize_script(
		'wc-enhanced-select',
		'wc_enhanced_select_params',
		array(
			'i18n_no_matches'                 => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
			'i18n_ajax_error'                 => _x( 'Loading failed', 'enhanced select', 'woocommerce' ),
			'i18n_input_too_short_1'          => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce' ),
			'i18n_input_too_short_n'          => _x( 'Please enter %qty% or more characters', 'enhanced select', 'woocommerce' ),
			'i18n_input_too_long_1'           => _x( 'Please delete 1 character', 'enhanced select', 'woocommerce' ),
			'i18n_input_too_long_n'           => _x( 'Please delete %qty% characters', 'enhanced select', 'woocommerce' ),
			'i18n_selection_too_long_1'       => _x( 'You can only select 1 item', 'enhanced select', 'woocommerce' ),
			'i18n_selection_too_long_n'       => _x( 'You can only select %qty% items', 'enhanced select', 'woocommerce' ),
			'i18n_load_more'                  => _x( 'Loading more results…', 'enhanced select', 'woocommerce' ),
			'i18n_searching'                  => _x( 'Searching…', 'enhanced select', 'woocommerce' ),
			'ajax_url'                        => admin_url( 'admin-ajax.php' ),
			'search_products_nonce'           => wp_create_nonce( 'search-products' ),
			'search_customers_nonce'          => wp_create_nonce( 'search-customers' ),
			'search_categories_nonce'         => wp_create_nonce( 'search-categories' ),
			'search_taxonomy_terms_nonce'     => wp_create_nonce( 'search-taxonomy-terms' ),
			'search_product_attributes_nonce' => wp_create_nonce( 'search-product-attributes' ),
			'search_pages_nonce'              => wp_create_nonce( 'search-pages' ),
			'search_order_metakeys_nonce'     => wp_create_nonce( 'search-order-metakeys' ),
		)
	);

	wp_localize_script(
		'wc-accounting',
		'accounting_params',
		array(
			'mon_decimal_point' => wc_get_price_decimal_separator(),
		)
	);
}