Error while updating drafts: [snippets/card-product.liquid] Liquid syntax error: Cannot use include

Error while updating drafts: [snippets/card-product.liquid] Liquid syntax error: Cannot use include

valorloff
Shopify Partner
4 0 0

I noticed a error in the dev environment yesterday and asked virtual agent for help:

me:  how to fix syntax error: Cannot use render tag in app snippets ?

 

- bot:  The render tag cannot be used in app snippets. Instead, use the include tag for app snippets to avoid syntax errors. Let me know if you need further clarification!

 

me:  if i change to include, then i get:

Liquid syntax error: Cannot use include tag in app snippets


 - bot:  The error "Liquid syntax error: Cannot use include tag in app snippets" occurs because the 
include tag is not supported in app snippets. Instead, you should use the render tag, which is the recommended method for including snippets in themes.

Would you like guidance on how to update your code or troubleshoot further?

🤣🤣🤣 
I have to ask here

Replies 4 (4)

Sonya_2025
Shopify Partner
345 37 60

Hi @valorloff 

Can you render tag in the section files? 

Pls share us all the code in this file

Please let me know if it works by giving it a Like or marking it as a solution!
Feel free to reach out.Get Shopify free trial 1$/mon
 EMAIL ME  Motivate me by  PAY ME
valorloff
Shopify Partner
4 0 0

Hi @Sonya_2025 
I have extensions/my-block/snippets/card-product.liquid, which is contain row: 

{% render 'price', product: card_product, price_class: '', show_compare_at_price: true %}
which is works in dev/ production last year, but in dev terminal appears:
Error while updating drafts: [snippets/card-product.liquid] Liquid syntax error: Cannot use render tag in app snippets 
What is mean and what i need do ?
Sonya_2025
Shopify Partner
345 37 60

Hi @valorloff 

Thanks for your reply

If the snippet is generated by an app, you cannot use {% include %} or {% render %} inside it. Instead, you need to modify the app snippet or the way it interacts with your theme.

Instead of having the app inject a snippet with {% include %}, create a custom snippet in your theme and call it directly from your theme files.

Please let me know if it works by giving it a Like or marking it as a solution!
Feel free to reach out.Get Shopify free trial 1$/mon
 EMAIL ME  Motivate me by  PAY ME
valorloff
Shopify Partner
4 0 0

@Sonya_2025 
Thanks for help!
how to call it directly from your theme files ?
and this is public app, you suggestion "create a custom snippet in your theme and call it directly from your theme files" breaks the principle of theme extension autonomy!
May be just have to manually paste the code into single snippet file?