I need to insert one button after search icon in shopify sites throgh the shopify app.Give me some suggestions.
我需要在shopify网站搜索图标后插入一个按钮shoprog app.Give我一些建议。
Thanks in Advance.
提前致谢。
1 个解决方案
#1
1
Hopefully you should replace/overwrite your snippets/header.liquid file in your store's theme with the help of Shopify API as below:
希望您应该在Shopify API的帮助下替换/覆盖商店主题中的snippets / header.liquid文件,如下所示:
In your app, try the below in your root function as:
在您的应用中,请在根函数中尝试以下内容:
header = ShopifyAPI::Asset.find("sections/header.liquid")
header.value # returns the contents of the header.liquid
update your header.value
using rails sub! as:
使用rails sub更新你的header.value!如:
#this will add the button at appropriate place instead `{% endif %}`
header.value.sub!("{% endif %}", "<button type='button'>Click Button</button> {% endif %}")
#do save
header.save
Hope this will help you!!
希望对你有帮助!!
#1
1
Hopefully you should replace/overwrite your snippets/header.liquid file in your store's theme with the help of Shopify API as below:
希望您应该在Shopify API的帮助下替换/覆盖商店主题中的snippets / header.liquid文件,如下所示:
In your app, try the below in your root function as:
在您的应用中,请在根函数中尝试以下内容:
header = ShopifyAPI::Asset.find("sections/header.liquid")
header.value # returns the contents of the header.liquid
update your header.value
using rails sub! as:
使用rails sub更新你的header.value!如:
#this will add the button at appropriate place instead `{% endif %}`
header.value.sub!("{% endif %}", "<button type='button'>Click Button</button> {% endif %}")
#do save
header.save
Hope this will help you!!
希望对你有帮助!!