Is there any way to call snippet of theme-app-extension inside theme files

pawanthalia
Shopify Partner
13 0 0

Hello , I'm experimenting with Theme App Extension , Is there any way to call snippet from theme app extension inside theme liquid files. 

TIA

Replies 3 (3)

EcomGraduates
Shopify Partner
735 63 105

hello there

 

Yes, it's possible to call a snippet of a theme app extension inside theme files. You can use the {% include %} Liquid tag to include the snippet in your theme file.

To do this, you will first need to locate the snippet file in your app extension. Once you have the path to the snippet file, you can include it in your theme file by adding the following code:

 

{% include 'path/to/your/snippet' %}

 

Make sure to replace "path/to/your/snippet" with the actual path to your snippet file.

You can also pass variables to the snippet by using the with statement, like this:

{% include 'path/to/your/snippet' with my_variable: 'value' %}

 

In this example, my_variable is the name of the variable being passed to the snippet, and 'value' is the value of the variable.

 

 


If this fixed your issue, likes and accepting as a solution are highly appreciated.

Build an online presence with our custom built Shopify Theme EcomifyTheme




pawanthalia
Shopify Partner
13 0 0

Hello,
Including snippet with liquid file is simple , and it's straightforward 
but locating extact path of app theme extension is not easy , if you have any example do share.

DiiLii
Shopify Partner
2 0 1

Hello, did you solve this issue? I'm currently struggling to make this happen thanks