0
votes

I have a Shopify app and would like to add it to Shopify as dynamic section programmatically. I know how to do it manually.

Basically i create .liquid file in sections in theme code editor. Here is short tutorial for adding dynamic sections: https://www.shopify.com/partners/blog/how-to-create-your-first-shopify-theme-section

But i would like to achieve the same result programmatically, i.e via some API call.

Is it possible at all?

2

2 Answers

1
votes

Yes it is possible, but the related API is in preview mode still and is not advised to be used in production environments.

Caution During the preview phase we will be making changes to the sections API based on your feedback. This may cause invalid theme code or page data to be present in preview shops. As the API is iterated upon, we will clean up existing data and theme code on beta-flagged preview shops, which may result in data loss. Changes will be communicated and documentation will be updated.

During the preview phase, the theme editor may not function properly on section-enabled pages.

That being said, have a look at Section Theme Rest API. Specifically, you will need to work with Sections Property.

0
votes

Liquid is a server side rendering language, this means you can not re-render on realtime. but you could render your code and hide it with display: none; and using axios or ajax after calling your API show that section.