WordPress at Your Fingertips
function is not described

WC_Frontend_Scripts::localize_script() private WC 2.3.0

Localize a WC script once.

{} It's a method of the class: WC_Frontend_Scripts{}

Hooks from the method
Return

null. Nothing.

Usage

$result = WC_Frontend_Scripts::localize_script( $handle );
$handle(string) (required)
Script handle the data will be attached to.

Changelog

Since 2.3.0 Introduced.
Since 2.3.0 this needs less wp_script_is() calls due to https://core.trac.wordpress.org/ticket/28404 being added in WP 4.0.

Code of WC_Frontend_Scripts::localize_script() WC 5.7.1

private static function localize_script( $handle ) {
	if ( ! in_array( $handle, self::$wp_localize_scripts, true ) && wp_script_is( $handle ) ) {
		$data = self::get_script_data( $handle );

		if ( ! $data ) {
			return;
		}

		$name                        = str_replace( '-', '_', $handle ) . '_params';
		self::$wp_localize_scripts[] = $handle;
		wp_localize_script( $handle, $name, apply_filters( $name, $data ) );
	}
}