Ad

Shopify Python Api: How Do Add New Assets To Published Theme?

- 1 answer

The shopify docs are horrible, I couldn't find any info on adding new assets to an existing shopify store.

We're developing an app that needs to add some css and liquid files.

Can someone here can shed some light on how to achieve this simple task?

Thanks

Ad

Answer

asset = shopify.Asset()
asset.key = "templates/josh.liquid"
asset.value = "{% comment %} Liquid is cool {% endcomment %}"
success = asset.save()

Be careful; if an asset already exists with the same key then it will be overwritten. You can find out more from the Asset API documentation.

Ad
source: stackoverflow.com
Ad