Model Viewer js is slowing page speed / scripts are loading in my head section , how to remove

Solved
taruunn
Excursionist
19 5 6

taruunn_0-1609409668633.png

 

 

I do not use any 3D product or model viewer but two scripts are loading in my head 

https://cdn.shopify.com/shopifycloud/model-viewer/v0.8/vendors~mv.js

https://cdn.shopify.com/shopifycloud/model-viewer/v0.8/model-viewer.js

 

I'm using Turbo theme , I tried everything to remove this but it loaded in head dynamically 

0 Likes
PaulNewton
Shopify Partner
2581 136 471

For excess system scripts this depends on whether they are loaded as part of the base theme or if they are being injected in the <head> from the {{ content_for_header}} tag.

Make a duplicate theme and test the duplicate theme by commented out the {{ content_for_header}} tag.

 

See if it's part of the base theme try:

Make sure any theme settings for 3D models are turned off.

If that doesn't work you'll have to go through your theme and possibly find any media areas and scripts that are used for 3D models and disabling those with comments.

Possibly including checking theme.js or other scripts for logic that loads the excess.

Problem Solved? ✔️Accept and ? Like the solution so you can help others.
Buy me a coffee ☕ paypal.me/paulnewton or donate to eff.org
Confused? Busy? Buy a custom solution paull.newton+shopifyforum@gmail.com
0 Likes
scandidownunder
New Member
1 0 0

Hey @taruunn

0 Likes
taruunn
Excursionist
19 5 6

Not Yet but i will find one day 

0 Likes
taruunn
Excursionist
19 5 6

@Jason Can you look into this 

0 Likes
taruunn
Excursionist
19 5 6

This is an accepted solution.

taruunn_0-1617377351167.png

Try this rename this with any wrong name in section.js & theme will never call this js 

 

0 Likes
SteveHoney
New Member
3 0 0

It's better to comment out the entire block with a note than randomly rename file versions - they just look like typos that way.

Note there are two occurences of the code to coment out in assets/sections.js

 

 

/* Disable 3D viewer scripts
    // Ensure product media libraries are present
    if (!isIE11) {
      window.Shopify.loadFeatures([
        {
          name: 'model-viewer',
          version: '0.8'
        },
        {
          name: 'shopify-xr',
          version: '1.0',
        },
        {
          name: 'model-viewer-ui',
          version: '1.0',
        }
      ], productMedia.setupMedia)
    }
*/

 

 

0 Likes
taruunn
Excursionist
19 5 6

Yeah But it will break your product single product image 

0 Likes
cescapesca_86
Excursionist
20 0 12

Hi, I have the same issue but I'm using the Flex theme (from the same company as the Turbo theme). I cannot find any files called section.js.liquid like in the accepted solution. Can anyone help me, please?

0 Likes
SteveHoney
New Member
3 0 0

Flex has partial JS files for sections, I don't have a copy of it locally but it looks likely to be in:

assets/scripts/sections/jsProduct.js

However I would be careful editing JS files if you are not familiar - the admin theme code editor does not store previous versions of JS files so it's possible to break things quite easily with no way to revert. Have a read of this:

https://help.outofthesandbox.com/hc/en-us/articles/360033812234

0 Likes