Closed billrobbins closed 2 years ago
We are not responsible for enqueueing core scripts, are you sure this issue is limited to WooCommerce Blocks 7.3.0 and not something coming from WordPress/Gutenberg.
We also had some recent updates to our script loading system, can you check 7.4.2 and confirm if this still persist?
I'm still seeing this in 7.4.2. If only WooCommerce is active, they load correctly. With Blocks active, they are not.
Here's a screenshot of the source code on the cart page. I've included the system report from another site showing this too.
This is still a problem with the current version 7.5.0. The above /wp-includes/js/dist URLS are added by WooCommerce Blocks when the plugin is enabled. You don't need to add "WooCommerce Checkout" or "WooCommerce Cart" blocks on your checkout or cart page. This results in dozens of 404 not found errors when a user visits the cart or checkout page on the website. The 404 errors can trigger security software to block a user, preventing a successful checkout.
I can confirm this is still happening in version 7.9
.
Also having these problems
LOTS of problems with WooCommerce Blocks. Does it work with wordpress installed in a sub-folder???? Here is example ...generates all 404 errors due to incorrect URLs missing the sub-folder of the Wordpress installation
WooCommerce Blocks is disabled, yet this continues to load when "logged in". Assume problem has been migrated into WooCommerce itself.
note that "www.my-word-press-url.com/wp-subfolder" replaces the actual Web URL... \
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/cart-frontend.js?ver=620b7d373bec23321d6df6f37f0ee13c' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/vendor/lodash.min.js?ver=4.17.19' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/vendor/react.min.js?ver=17.0.1' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver=3.15.0' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/vendor/regenerator-runtime.min.js?ver=0.13.9' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/blocks-checkout.js?ver=eb82aea7f2ef0716e0c56bede54457db' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-registry.js?ver=cc03e8063dded1b5b150fe0ddbbbdad5' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/deprecated.min.js?ver=96593d5d272d008fbcb6912fa0b86778' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/hooks.min.js?ver=c6d64f2cb8f5c6bb49caca37f8828ce3' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/element.min.js?ver=3dfdc75a0abf30f057df44e9a39abe5b' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/vendor/react-dom.min.js?ver=17.0.1' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/escape-html.min.js?ver=00a5735837e9efe13da1d979f16a7105' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-settings.js?ver=ad63e06f578c9c6502bc833752112b83' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/i18n.min.js?ver=ebee46757c6a411e38fd079a7ac71d94' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/api-fetch.min.js?ver=63050163caffa6aac54e9ebf21fe0472' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/url.min.js?ver=16385e4d69da65c7283790971de6b297' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/compose.min.js?ver=e52c48958a19b766c6a9d28c02d53575' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/dom.min.js?ver=3c10edc1abf3fbbc79f17fd7d1d332eb' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/is-shallow-equal.min.js?ver=649feec00389556f8015a6b97efc1cb1' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/keycodes.min.js?ver=84a0e6bbcf0b9e1ea0184c3f2bf28022' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/priority-queue.min.js?ver=efad6460ae6b28406d39866cb10731e0' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/data.min.js?ver=6c1ab5799c4b061254d313d2d8d9fb87' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/redux-routine.min.js?ver=5156478c032ea85a2bbdceeb7a43b0c1' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/primitives.min.js?ver=cadf5cfaabdb15c8c8fc440547afe919' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/warning.min.js?ver=b9190af8fc6a3a48c580473c6f337b88' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-data.js?ver=fe03f3839f075526d21ae177dab4a7f4' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/data-controls.min.js?ver=6a75067d86cf9ab901a4646595575446' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/html-entities.min.js?ver=c6385fb7cd9fdada1cf8892a545f8a26' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/notices.min.js?ver=e44820c667bf205cacdfc48cbeb3c2e6' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-middleware.js?ver=b7f556f584fec6665368156bab725769' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-shared-hocs.js?ver=f801ba4198a186c414f0f55e0fef964e' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/wc-blocks-shared-context.js?ver=0f089e2e633ea186a0eaeb7320fe717e' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/price-format.js?ver=7c3723933eb56bafdb6e36d072625c93' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/a11y.min.js?ver=a38319d7ba46c6e60f7f9d4c371222c5' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/dom-ready.min.js?ver=d996b53411d1533a84951212ab6ac4ff' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/autop.min.js?ver=21d1d6c005241b908b592f52ad684a28' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/plugins.min.js?ver=f885533aefb501e1eedcbd4a9d04ca70' as='script' rel='prefetch' />
<link href='/wp-includes/js/dist/wordcount.min.js?ver=fb8056c75aa0a0569f7ea3ceae97fbc6' as='script' rel='prefetch' />
<link href='https://www.my-word-press-url.com/wp-subfolder/wp-content/plugins/woocommerce/packages/woocommerce-blocks/build/checkout-frontend.js?ver=7027935b689ef42bf26dad229bbdb08b' as='script' rel='prefetch' />
<script type="text/javascript">``
I'm going to investigate this today and let you know if I manage to reproduce it and if I can fix it.
Hello, It seems to be a wordpress problem in the file script-loader.php, it loads scripts with this relative path to webroot /wp-includes/...
$path = "/wp-includes/js/dist/vendor/$handle$suffix.js";
functions : wp_default_packages_vendor() / wp_default_packages_scripts() / etc
I could miss something as the script is complex and... messy.
I'm having the same issue but i don't have woo blocks plug in installed. Happens when i have a user logged in every page 404 responds because a i have Wp installed in his own folder.
I'm having the same issue but i don't have woo blocks plug in installed. Happens when i have a user logged in every page 404 responds because a i have Wp installed in his own folder.
Looks as if the problem has migrated from woocommerce blocks into woocommerce itself . It affects all logged in users OR when an item is in the cart and WP is installed in a sub-folder.
Same problem here. Wordpress installed in subdirectory /wp (bedrock). Rolling back to 6.8.2 fixes the issue
This also causes problems with the ?wc-ajax=get_refreshed_fragments
request, which is automatically canceled.
Problem is caused by add_filter( 'wp_resource_hints', array( $this, 'add_resource_hints' ), 10, 2 );
I'm having the same issue but i don't have woo blocks plug in installed. Happens when i have a user logged in every page 404 responds because a i have Wp installed in his own folder.
Looks as if the problem has migrated from woocommerce blocks into woocommerce itself . It affects logged in users only, and if WP is installed in a sub-folder.
For me happens when you have some product in your cart, even if you are logged in or out!
For me happens when you have some product in your cart, even if you are logged in or out!
Yes you are right! didnt notice that!
Hi,
Also ran in to this issue.
Rolling back was not an option si I added this to our in-house mu-plugin as a temporary fix and maybe a few people can adapt it to their project while waiting for a fix:
You'll need to at least change the filter declaration to not use "Core::" and remove "public static" if used outside a class.
public static function boot(){
if( ! function_exists('is_plugin_active') ){
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
if( ! is_plugin_active('woocommerce/woocommerce.php') ){
return;
}
if( version_compare(WC()->version, '6.3.1', '>') && version_compare(WC()->version, '6.9.3', '<=') ){
Core::add_filter( 'wp_resource_hints', ['WooCommerce', 'wp_resource_hints'], 99, 2 );
}
}
/**
* Fix resource hints for WooCommerce 6.3.1+ - 6.9.3
*
* @param array $urls URLs to print for resource hints. Each URL is an array of resource attributes, or a URL string.
* @param string $relation_type The relation type the URLs are printed. Possible values: preconnect, dns-prefetch, prefetch, prerender.
*
* @return array WooCommerce resource hints (corrected if relation type is 'prefetch' and href starts with a '/').
*/
public static function wp_resource_hints( $urls, $relation_type ){
if( 'prefetch' === $relation_type ){
array_walk( $urls, function( &$url ){
if( '/' === $url['href'][0] ){
$url['href'] = site_url( $url['href'] );
}
});
}
return $urls;
}
Hope this helps. Cheers.
We now have a fix here https://github.com/woocommerce/woocommerce-blocks/pull/7211
@tombroucke do I understand that this bug is breaking cart functionality for you?
Thank you all for reporting. A fix for this issue will be shipped in WC Blocks 8.6.0 coming next week.
WC Blocks 8.5.1 – 2022-09-23 Bug Fixes Ensure that scripts are loaded using absolute URLs to prevent loading issues with subfolder installs. (7211)
Did that fix your issue @getfaxing ?
Did that fix your issue @getfaxing ?
Yes, updated to 8.5.1 and enabled WooCommerce Blocks plug-in. Seems to have resolved the 404s
Describe the bug
Prior to version 7.3, scripts loaded from
/wp-includes
used absolute URLs. Now they use relative URLs. If someone has placed WordPress in a sub-folder, this will cause all of the scripts to return 404 errors.The scripts included with the plugin continue to use absolute URLs.
To reproduce
Steps to reproduce the behavior:
/wp-includes
scripts.Expected behavior
I expected the scripts to continue to use absolute URLs.
Screenshots
Before 7.3
Version 7.3
Environment
WordPress (please complete the following information):
Additional context
Reported here: https://wordpress.org/support/topic/relative-vs-absolute-url-causing-problems