Prevent script caching by using the WC core version to hash Interactivity API assets instead of old WC Blocks version (#44806)
* Prevent script caching by using the WC core version to hash Interactivity API assets instead of old WC Blocks version * Add changelog entry
This commit is contained in:
parent
ccb1fb3d76
commit
6b9e732ebf
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Prevent script caching by using the WC core version to hash Interactivity API assets instead of old WC Blocks version
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
use Automattic\Jetpack\Constants;
|
||||
|
||||
/**
|
||||
* Move interactive scripts to the footer. This is a temporary measure to make
|
||||
* it work with `wc_store` and it should be replaced with deferred scripts or
|
||||
|
@ -36,7 +38,8 @@ function woocommerce_interactivity_register_runtime() {
|
|||
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG && file_exists( $file_path ) ) {
|
||||
$version = filemtime( $file_path );
|
||||
} else {
|
||||
$version = \Automattic\WooCommerce\Blocks\Package::get_version();
|
||||
// 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(
|
||||
|
|
Loading…
Reference in New Issue