You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
I encountered this issue during the staging of a redesign:
The site was developed locally under Lando, in HTTPS, on a Bedrock architecture: redesign from a classic WC to a FSE WC, preserving the database.
So far, so good.
The site was then installed in staging, the database was imported and then adapted using wp db import and wp search replace.
The result: the blocks no longer worked.
The console indicated a mixed-content issue with the WC Blocks scripts related to the blocks on the page that were loaded in HTTP instead of HTTPS:
Specifically, on the home page with a customer account block, and a mini-cart block in the menu header: wc-settings.js, mini-cart-frontend.js, price-format.js (I'm not completely certain about the last one, but I am about the first two).
No other scripts from other plugins had this problem.
My staging, also using a Bedrock architecture, had in its .env its WP_ENV set to staging which defined SCRIPT_DEBUG to false. When I switched its WP_ENV to development which defined SCRIPT_DEBUG to true, the problem disappeared.
I have no idea why this transient has a URL in HTTP instead of HTTPS. A recording during an SSL certificate crash maybe? I don't know.
In any case, once recorded it cannot be updated.
After looking at the code, my first attempt was to delete all the transients via the WooCommerce tools. Negative.
My second attempt was to install the Transient Manager plugin to delete the transient woocommerce_blocks_asset_api_script_data. Negative.
The only thing that worked was to fix the values using a wp search-replace 'http:\/\/mystaging' 'https:\/\/mystaging'
I am in the case where disable_cache is false:
If script_data is null, we don't update it
If script_data contains something (and in my case something wrong), we put its value back in the transient
I might be making a mistake in my analysis, or perhaps the problem is more complex, but in any case, the problem was definitely there :)
To reproduce
Steps to reproduce the behavior:
Modify the transient woocommerce_blocks_asset_api_script_data via PHPMyAdmin by replacing the HTTPS in the script wc-settings.js URL with HTTP
See the mixed-content problem on a page using WC Blocks
Attempt to delete the transient to fix the problem.
Environment
MacOS Ventura, Chrome...
WordPress (please complete the following information):
WordPress version: 6.2.2
WooCommerce version: 7.8.2
WooCommerce Blocks version: 10.6.0
The text was updated successfully, but these errors were encountered:
webaxones
changed the title
Script cache impossible to update when the transient already contains an incorrect value.
Impossible to update cached script when transient already contains an incorrect value
Jul 15, 2023
@webaxones thanks for posting this, I was experiencing this issue too, but I experienced it when switching between the WooCommerce Feature plugin and the plugin bundled with WooCommerce core, which is something sites out in the wild could reasonably do.
Just curious if the HTTP loading can break scripts from other plugins, merchant in 6566216-zen had issues loading WCPay dashboard when Woo Blocks was active;
Just curious if the HTTP loading can break scripts from other plugins, merchant in 6566216-zen had issues loading WCPay dashboard when Woo Blocks was active;
Looks like, since wc-settings isn't loading it's stopping other scripts working.
Describe the bug
I encountered this issue during the staging of a redesign:
The site was developed locally under Lando, in HTTPS, on a Bedrock architecture: redesign from a classic WC to a FSE WC, preserving the database.
So far, so good.
The site was then installed in staging, the database was imported and then adapted using
wp db import
andwp search replace
.The result: the blocks no longer worked.
The console indicated a mixed-content issue with the WC Blocks scripts related to the blocks on the page that were loaded in HTTP instead of HTTPS:
Specifically, on the home page with a customer account block, and a mini-cart block in the menu header: wc-settings.js, mini-cart-frontend.js, price-format.js (I'm not completely certain about the last one, but I am about the first two).
No other scripts from other plugins had this problem.
My staging, also using a Bedrock architecture, had in its
.env
itsWP_ENV
set tostaging
which definedSCRIPT_DEBUG
tofalse
. When I switched itsWP_ENV
todevelopment
which definedSCRIPT_DEBUG
totrue
, the problem disappeared.I have no idea why this transient has a URL in HTTP instead of HTTPS. A recording during an SSL certificate crash maybe? I don't know.
In any case, once recorded it cannot be updated.
After looking at the code, my first attempt was to delete all the transients via the WooCommerce tools. Negative.
My second attempt was to install the Transient Manager plugin to delete the transient
woocommerce_blocks_asset_api_script_data
. Negative.The only thing that worked was to fix the values using a
wp search-replace 'http:\/\/mystaging' 'https:\/\/mystaging'
I believe the problem comes from this commit
more specifically from this code
I am in the case where
disable_cache
isfalse
:If
script_data
isnull
, we don't update itIf
script_data
contains something (and in my case something wrong), we put its value back in the transientI might be making a mistake in my analysis, or perhaps the problem is more complex, but in any case, the problem was definitely there :)
To reproduce
Steps to reproduce the behavior:
woocommerce_blocks_asset_api_script_data
via PHPMyAdmin by replacing theHTTPS
in the scriptwc-settings.js
URL withHTTP
Environment
MacOS Ventura, Chrome...
WordPress (please complete the following information):
The text was updated successfully, but these errors were encountered: