diff --git a/src/BlockTypes/MiniCart.php b/src/BlockTypes/MiniCart.php index 80e9330ce40..8028cfd985a 100644 --- a/src/BlockTypes/MiniCart.php +++ b/src/BlockTypes/MiniCart.php @@ -276,8 +276,12 @@ protected function append_script_and_deps_src( $script ) { if ( ! $script->src ) { return; } + + $site_url = get_site_url(); + $path = wp_parse_url( $site_url )['path'] ?? ''; + $this->scripts_to_lazy_load[ $script->handle ] = array( - 'src' => $script->src, + 'src' => wp_http_validate_url( $script->src ) ? $script->src : $path . $script->src, 'version' => $script->ver, 'before' => $wp_scripts->print_inline_script( $script->handle, 'before', false ), 'after' => $wp_scripts->print_inline_script( $script->handle, 'after', false ),