For discussing the development and usage of Checkout UI extensions, post-purchase extensions, web pixels, Customer Accounts UI extensions, and POS UI extensions
Hi there,
I'm developing a checkout UI extension that needs to behave differently depending on whether the store is plus or not.
It's an extension that goes in the "thank-you page", so plus and not-plus stores can access it.
Is there a programmatically way to check if the store is plus or not?
Or at least is there a way to show an extension in the "thank-you page" theme editor only if it's a plus store and vice versa? In this situation I would create two different extensions in my project, one for plus and one for not-plus.
Thank you
Solved! Go to the solution
This is an accepted solution.
Hello @isendu-dev
If the customer exists, you can call the API for the shop plan when your app loads. You need to call either the shop's REST API or GraphQL API to determine which plan is associated with the customer's store. Simply update the metafield value based on the store plan. Avoid asking the client to reinstall the app, as this creates a poor user experience. Instead, call the API on the initial app load to check for the plan, and call this API for first time and update value if you have the store plan then avoid to call this API
For the REST API, refer to: https://shopify.dev/docs/api/admin-rest/2024-04/resources/shop
For the GraphQL API, refer to: https://shopify.dev/docs/api/admin-graphql/2024-01/objects/Shop
If the solution presented meets your needs and addresses your query effectively, I encourage you to accept it as the chosen answer. This will acknowledge the support you received and aid fellow community members in identifying reliable and effective solutions for their similar concerns.
Thank you.
Hello @isendu-dev
When you install your app, at that time by using middleware you can call the Shopify Store API from the Admin API using GraphQL or the REST API. The Shopify Store API provides the shop plan information, which you can store in a shop metafield. You can then use this metafield value in your extension to show or hide your widget according to the shop plan.
If the solution presented meets your needs and addresses your query effectively, I encourage you to accept it as the chosen answer. This will acknowledge the support you received and aid fellow community members in identifying reliable and effective solutions for their similar concerns.
Thank you.
Hi @Huptech-Web
Your answer is quite good (and I will accept is as the chosen answer).
However, it would have been better if I had been able to access this information within the useApi of the ui-extensions-react/checkout that I'm using in my extension. Ok, yes, I can access to metafields instead, but my app has been already installed by hundreds of clients (and I can't ask them to reinstall it), so I can't have that info from them.
This is an accepted solution.
Hello @isendu-dev
If the customer exists, you can call the API for the shop plan when your app loads. You need to call either the shop's REST API or GraphQL API to determine which plan is associated with the customer's store. Simply update the metafield value based on the store plan. Avoid asking the client to reinstall the app, as this creates a poor user experience. Instead, call the API on the initial app load to check for the plan, and call this API for first time and update value if you have the store plan then avoid to call this API
For the REST API, refer to: https://shopify.dev/docs/api/admin-rest/2024-04/resources/shop
For the GraphQL API, refer to: https://shopify.dev/docs/api/admin-graphql/2024-01/objects/Shop
If the solution presented meets your needs and addresses your query effectively, I encourage you to accept it as the chosen answer. This will acknowledge the support you received and aid fellow community members in identifying reliable and effective solutions for their similar concerns.
Thank you.
hello @isendu-dev
Does the above solution work for you?
Hi @Huptech-Web
I was trying to understand if your solution fits with my scenario.
My app is an "extension-only" app, so if I'm not wrong, I can't have all those info from REST API because I can't access to accessToken. I'm very poor on understanding everything about this part of Shopify, sorry if I said something very dumb.
However, I found another solution that doesn't need to check on store plan.
Thank you anyway!