diff --git a/src/BlockTypes/MiniCart.php b/src/BlockTypes/MiniCart.php index 80e9330ce40..53a0f91d891 100644 --- a/src/BlockTypes/MiniCart.php +++ b/src/BlockTypes/MiniCart.php @@ -276,8 +276,11 @@ protected function append_script_and_deps_src( $script ) { if ( ! $script->src ) { return; } + + $site_url = site_url() ?? wp_guess_url(); + $this->scripts_to_lazy_load[ $script->handle ] = array( - 'src' => $script->src, + 'src' => preg_match( '|^(https?:)?//|', $script->src ) ? $script->src : $site_url . $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 ),