Shopify / theme-extension-getting-started

A theme app extension boilerplate that highlights the basic structure and features that are available to developers who want to integrate their apps with Shopify Online Stores.
https://shopify.dev/apps/online-store/theme-app-extensions/getting-started
MIT License
105 stars 45 forks source link

How to reuse liquid snippets from extension app in theme #26

Open almeidaz opened 1 year ago

almeidaz commented 1 year ago

I've create an app-extension which is working fine. i use : extensions/appname/blocks/app-block.liquid extensions/appname/blocks/app-embed.liquid

also : extensions/appname/snippets/my-snippet.liquid

I'm able to render my-snippet.liquid in app-block.liquid like that : {% render 'my-snippet' %} and all works fine.

but now i need to use {% render 'my-snippet' %} somewhere else in my theme. In product-card.liquid in my case. There is no possibility to add block via Customise in this situation.

When i try to {% render 'my-snippet' %} in product-card.liquid i get an error

Liquid error (snippets/product-card line 89): Could not find asset snippets/my-snippet.liquid

I understand that now app extension have assets separated from Theme directory and are published via extension.

How can i {% render 'my-snippet' %} in product-card.liquid ? It is possible? there is a special path like {% render 'app-name/my-snippet' %} or {% render 'app-id/my-snippet' %}

Thanks in advance.