For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hi,
I want to enable/disable functionality of an extension on click of a button on embedded app or admin side. I have stored the state of button in Laravel database. Now, I have two approaches. One, when saving the state of button i disable the extension, but the question here is can we disable an extension? In which file the extension is configured? Second, I add if/else condition on schema (extension is creating a section in theme) in extension liquid file, this can be done by hitting API which will get the state of button from database. The confusing part here is how am I going to call API in liquid file to get data from Laravel database. Any idea what would be the right approach to implement this functionality?
Hey @mozainarashid
Are you referring to app blocks? The best way is to store the enabled/disabled state in a metafield to avoid having to call an API. Here's an example: https://shopify.dev/docs/apps/online-store/theme-app-extensions/extensions-framework#conditional-app...
Scott | Developer Advocate @ Shopify
Yes, but what If I am storing state in database. How to implement this functionality?
Hey @mozainarashid
That's not possible. You'd need to sync the database with the metafield (using Shopify's API), or better yet use Shopify as the source of truth.
Scott | Developer Advocate @ Shopify