Storefront Web Components

shopify.dev

159 points by maltenuhn 3 days ago


blittle - 3 days ago

I'm on the dev team that built this. Happy to answer any questions!

We essentially use web components as a templating language to dynamically generate a GraphQL query to Shopify. Then render the data as text nodes inside the web components. This is powerful because the components don't include shadow roots. So you can come with your own HTML and CSS.

Most web component libraries are opinionated about design, and give you many CSS custom properties or CSS parts to customize. We tried really hard to invert that, and instead give you the design control. Most of our web components just produce a text node, with no shadow root!

There's a few exceptions, like the cart for example, where it's easier to just have an out of the box component that does it all for you `<shopify-cart>`. Though...you can actually build the entire cart component with the lower level primitives!

skeptrune - 3 days ago

I could not understand what this was from the linked site. Docs if anyone is curious - https://shopify.dev/docs/api/storefront-web-components.

I really appreciate that they built this. The `shopify-context` is especially useful. Makes rendering all of the various resources infinitely easier.

superchris - 3 days ago

This is great, I think this is perfect use for web components and gives your customers trying to build a fully custom storefront a much better experience. I built something similar for stripe based sites a couple years ago but didn't get too much attention: https://elements.launchscout.com/

mercurialsolo - 3 days ago

This is a master move though - it's kinda like video(youtube) embeds in your site. If every site could sell and have an infinite curated catalog from shopify merchants - shopify becomes both the discovery, distribution and the shopping network?

no_wizard - 3 days ago

It seems that maybe web component advocates are right. Eventually they’ll eat everything, even if slowly.

Shopify for the longest time had a “hardline” with only supporting React directly, if I recall correctly

_benton - 3 days ago

These are awesome! Perfect use case for web component, incredible how much less code and work is required compared to hydrogen with React (no disrespect intended). Very clever.

Is it going to be open sourced at all? I took a brief look at shopify's GitHub and didn't see it there.

skrebbel - 3 days ago

Now this is what Web Components are great for.

The playground is very well done btw, worth checking out IMO: https://webcomponents.shopify.dev/playground?view=editor

jonah - 3 days ago

Heh, they have prompts you can feed to an LLM:

https://webcomponents.shopify.dev/llms.txt

jjcm - 3 days ago

Shopify's tooling is top notch. They're one of my go-to examples of a really well engineered design system and usable docs. Highly recommend using them for inspiration (and obv for integration if you need a shop front).

- 3 days ago
[deleted]
threeseed - 3 days ago

Are developers able to use this within Shopify apps ?

I wish Shopify made it easier to discern who the audience are for these frameworks since they have quite a few.

theyknowitsxmas - 3 days ago

Does this work on the Starter plan, that is, headless? When I talked to NextJS Commerce devs years ago they said no.

qu0b - 2 days ago

This is great, now that react 19 also supports web components this makes total sense.

- 3 days ago
[deleted]
desireco42 - 3 days ago

Solid. I really like this direction.

I never used Shopify much, can it be used to deliver digital products?

azar1 - 3 days ago

I opened the demo and said out loud "this is nuts!". Amazing job team.

lelandfe - 2 days ago

Probably the best fit for web components I've seen. Very cool.

zero0529 - 3 days ago

I don’t understand is this made for the hydrogen framework?

postepowanieadm - 3 days ago

MD version is intended for LLM consumption?

firemelt - 2 days ago

this is the future web that I want

bflesch - 3 days ago

Shopify currently has a scandal in Germany because they blocked payouts for a TV-famous startup which "ships too slowly".

The startup locally produces clothing from sheep wool and only starts production once the order is in. Shopify is unable to understand the concept of make-to-order-production, it's a bit ridiculous to see what their support people are writing.

More on youtube: https://www.youtube.com/watch?v=ovRpTsHO13U

metalrain - 3 days ago

What a terrible UX on that site. This site barely works on my mobile.

When I think storefront I think simple & fast, this site is not at all that.

Stores are "hidden" by design, it is about the products and store itself just provides them.

delusional - 3 days ago

As other have mentioned the site design is way overcooked. It's also interesting that the example products all seem to be riffs off of Teenage Engineering stuff.

charlesabarnes - 3 days ago

I _really_ dislike this marketing site, but I really appreciate this effort from shopify.

constructive criticism: It looks cool, but it took far too long to get my bearings on the site

victor106 - 3 days ago

[flagged]