Which API would I use to publish a table from an embedded app to the storefront?

Solved
Excursionist
20 3 2

I have an embedded app that allows a user to create a table. Within the table a merchant can manipulate the columns and row values (very basic yet flexible).

 

I was wondering if it was possible to allow the merchant to click a button within the app which would trigger the table publishing to the merchants website?

 

If possible, which API would I use? Graph? Storefront? Other?

Would the merchant need to customize their theme?

 

Thanks in advance.

0 Likes

Success.

Shopify Staff
Shopify Staff
1558 77 232

That would be possible. I assume you already have the HTML and CSS you need on your end, so you could take that and publish it via the admin assets REST API and/or the admin script tags REST API.

 

https://help.shopify.com/en/api/reference/online-store/asset

https://help.shopify.com/en/api/reference/online-store/scripttag

 

There's an Admin GraphQL API  alternative for script tags:

 

https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/scripttagcreate

 

The rest is just deciding when and where to render/publish that table using these tools. There's probably more than just these approaches, but those are what immediately came to mind.

 

Cheers.

1 Like
Excursionist
20 3 2

Thanks @Alex. I am moving forward on the ScriptTag. Thanks.

0 Likes
Shopify Partner
1737 48 156

Do keep in mind ScriptTag is greate when you need to use javascript to dynamically change|fetch something, this gets over used alot and contributes to creeping performance issues for stores as they add more apps.

 

As you iterate script_tags may be fast but if your just rendering html consider letting merchants add a liquid include to their templates where they want the table to appear and use the assets api to add a snippet, or pages api to use page techniques.

Problem Solved? ✔️Accept the solution so you can help others.
Confused? Busy? ? Get me to solve it paull.newton+shopifyforum@gmail.com.
Buy me a coffee? ☕ paypal.me/paulnewton or donate to eff.org
0 Likes
Highlighted
Excursionist
20 3 2

Thanks @PaulNewton. I have heard talk of developers adding in this option. I think I will work on adding this after I have completed my initial build. Thanks again for the suggestion.

0 Likes