OK, a couple people have asked- so here is step by step what I did to get the 3D / AR viewer on the home page:
First: I am using the “Craft” theme by Shopify, it’s one of the default themes available for free. I think this should work with Dawn as well.
Steps:
1:.. prepare your 3D model and save it as a GLB or GLTF file
2:.. go over to google’s 3d model viewer website: https://modelviewer.dev/
3:.. under “getting started”, click on “editor”
4:.. upload your 3d model
5:.. you can play with the settings here, or just leave it as it is
6:.. click “download scene”
7:.. extract the zip file that you just downloaded.. you will need the following files from the zip file:
------- here’s where everything gets a little silly, because… shopify..
8:.. upload the two png files and the glb file to shopify (under “content” and “files”)
9:.. get the full URL’s for the files you just uploaded and save them somewhere
10:.. in the Customizer, create a “custom liquid” section on your home page. here is where all your code is going to go
11:.. to begin, create a div with a defined height (check out www.w3schools.com if you need help with basic html coding)
12:.. open the index.html file that you downloaded from google
13:.. copy everything from “<model-viewer…” to “” and paste this into your div from step 11
14:.. swap out the src URL’s for your GLB and the two PNG’s for the ones from step 9
15:.. above your div (step 11), add style tags (“ ”)
16:.. copy the contents of style.css (step 7) and paste it in between the style tags
17:.. underneath your div (step 11), create script tags (“”)
18:.. copy the contents of the script.js file (step 7) and paste it in between your script tags
19:.. save!
that should be it. seems like a lot but it should only take 5 minutes to set up.
the mistakes that i made were: trying to load the model-viewer js code (at the bottom of the index.html file), when apparently this is already included in the Craft (and presumably, Dawn) theme, and not adding a defined height to the div in step 11.
hope this helps you