-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to add snippet in theme.liquid in Shopify App (Using PUT api) #28
Comments
Hi @gautam14 |
Hi myjanky Thanks for your response. I read this post and follow the way it tells $shopify('PUT /admin/themes/145783113/assets.json', array( to append the data/value, but the main problem is that when I append my data in theme.liquid it overwrite all the previous data and just append "hello" in file. Can you please tell how I can append my data after/before the particular data in theme.liquid file. Thanks! |
The value must contain the entire liquid of the theme.liquid file as well as your "Hello" wherever you want it to be at. For example if the contents of theme.liquid are
You would grab a copy of the theme liquid with the asset API get.
then pass new_theme in as the value parameter in the put |
Hi myjanky, I have tried the code but getting the desired result. --my code is: "<?php
But "hello" is not appending in code. I just the beginner, can you please tell where I am doing wrong. Thanks! |
I am not sure that JS is correct. Do you have the console errors from console.log? |
Hi myjanky, I don't know whats going wrong, but no error is showing in console.log. Can you please help me in this, I just want modify theme.liquid using API. Thanks! |
I would not mix PHP and JS for this. I was thinking you would use one or the other. printr($me); what is in that?> |
Hi,
I am building an shopify app using phpish/shopify_app-skeleton, can anyone tell me how to add the snippet in theme.liquid when app is installed in store first time. I used this code
$shopify('PUT /admin/themes/145783113/assets.json', array(
'asset' => array(
'key' => 'layout/theme.liquid',
'value' => "hello";
) ));
But this code overwrite whole code and just append "hello" . Please help me in adding snippet and content to it.
Thanks
The text was updated successfully, but these errors were encountered: