0

我需要通过shopify应用在shopify网站的搜索图标后插入一个按钮。给我一些建议。

喜欢这张图片

提前致谢。

4

1 回答 1

1

希望您应该在 Shopify API 的帮助下替换/覆盖商店主题中的 snippets/header.liquid 文件,如下所示:

在您的应用程序中,在您的根函数中尝试以下操作:

header = ShopifyAPI::Asset.find("sections/header.liquid")
header.value # returns the contents of the header.liquid

更新您header.value使用的 rails sub!作为:

#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

希望对你有帮助!!

于 2017-07-06T11:08:21.590 回答