Can I connect to our site, via ajax, on behalf of the account owner - theme app extension

Can I connect to our site, via ajax, on behalf of the account owner - theme app extension

Morsal
Visitor
2 0 0

Hello, 

 

I am creating an app block with theme app extension with a select menu for the online store. The goal is to allow users/merchants to install our app, add the app by using Add Block and then hit the select menu and select a booklet/pdf from our site to embed on their storefont. 

 

I am currently using Shopify CLI 3.0 and have the app installed to our store with the select menu (on the right panel) but the values are hardcoded at the moment.

 

I wanted to know: 

 

1) Can I connect to our site, via ajax, on behalf of the account owner and pull a booklet list?
2) Can I dynamically update the drop-down menu with that booklet list?

 

I have the liquid file for the block looking like this:

 

app-block.liquid:

 

 
<iframe src='https://louddoc.com/embed.php?wpKey={{ block.settings.workpad_key }}&source=embed' allowfullscreen width='100%' height='1220' style='border: 0; overflow: hidden; width: 1px; min-width: 100%; max-width:950px;' scrolling='no'></iframe></span>

{% schema %}
{
"name": "Title for App",
"target": "section",
"stylesheet": "app.css",
"javascript": "app.js",
"settings": [
{
"type": "select",
"id": "workpad_key",
"label": "Embed your booklet to your store",
"options": [
{
"value": "5xsYPWgs3l3VbOK1izBx6j",
"label": "Booklet 1"
},
{
"value": "C8Ij8PqtVpDvVpVNVXDQhw",
"label": "Booklet 2"
},
{
"value": "hLxVnSxFJuLw3iCvpfLko1",
"label": "Booklet 3"
}
]
}
]
}
{% endschema %}

 

Screen Shot 2022-09-13 at 3.08.48 PM.png

 

 

Replies 0 (0)