Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Enable extension only for plus stores

Solved

Enable extension only for plus stores

isendu-dev
Shopify Partner
8 0 0

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

Accepted Solution (1)
Huptech-Web
Shopify Partner
1084 210 232

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.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required

View solution in original post

Replies 5 (5)

Huptech-Web
Shopify Partner
1084 210 232

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.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
isendu-dev
Shopify Partner
8 0 0

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.

Huptech-Web
Shopify Partner
1084 210 232

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.

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
Huptech-Web
Shopify Partner
1084 210 232

hello @isendu-dev 

Does the above solution work for you?

If you found this response helpful, please do like and accept the solution. Thanks!
Need support with Customizing your Shopify store?
Feel free to contact me at info@huptechweb.com or Visit our website Huptech Web.
Instant Shortcode Builder: Integrate customizable UI features anywhere in your store - No coding knowledge required
isendu-dev
Shopify Partner
8 0 0

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!