How to use write_themes and Billing API together during development?

Hi,

I’m building a Shopify app that needs the write_themes scope. I submitted the exemption form and got approved, but was asked to keep the app as a custom app during development.

Later, when I started adding billing, I found out that custom apps can’t use the Billing API.

I reached out again, submitted another exemption form, and created a public app while waiting. When I asked if write_themes could be enabled on the new app, I was told to submit a third exemption request for the same use case and to ask for help in the Shopify dev community.

Right now I’m not sure how to move forward.

Custom app – access to write_themes, no Billing API
Public app – access to Billing API, no write_themes

What’s the right setup to develop and test both features together?

Thanks in advance.

The type of access scope shouldn’t require additional approval, even on a custom app.

Have you tried updating your app’s access scopes, and reinstalling it to your development store to confirm if the new access scope is requested?

Hello Dylan,

Thank you for your response.

I did try, but unfortunately, when using a public app, whenever I try to do ‘post’, ‘put’ and ‘del’ operations on a theme’s files, I am presented with a 404 error. However, it does work fine with the custom app.

I came across this on Shopify’s documentation: " Starting with Admin API 2023-04, Asset resource PUT or DEL requests are restricted using the write_themes"

Based on that, I have sent another exemption form yesterday and this public app was approved. However, I’m still unable to do CRUD operations.

I have reinstalled the app. I should have access to PUT and DEL operations on this new public app by now, isn’t that correct?

I’m not sure if I’m missing something from a technical perspective or if it requires any type of additional approval.

I’m happy to provide any additional info to clarify the situation.

Thanks again.

Diego

Yes, you do need extra approval for the write_themes scope, and you should be able to get this on your public app. I’m not sure why they told you to keep your app as a custom app, this isn’t needed for the write_themes scope.

If you still can’t make CRUD requests after getting approval, double-check that your app has the write_themes access scope and that you’ve deployed the latest version. Try running npm run deploy or whatever command you use to publish updates, just to make sure the new access scope is included.

If it still doesn’t work, can you share the endpoint you’re using? Also, as far as I know, you shouldn’t use the REST API for this anymore. Try using the GraphQL version instead. For example, to create or update a file in a theme, you can use this mutation: themeFilesUpsert - GraphQL Admin

Hello @Gulam_Hussain_Quinn

Thank you very much for your input. Your suggestion led me to find a solution.

Long story short, I tested themeFilesUpsert via the GraphiQL panel, and it yielded the following error:

Access denied for themeFilesUpsert field. Required access: The user needs write_themes and an exemption from Shopify to modify theme files.
If you think that your app is eligible for an exemption and should have access to this API, then you can submit an exception request.

From there I contacted Shopify via the email I received from the exemption form, and then they granted me access to the API.

I appreciate you and @Dylan 's support once again. Wishing you all a nice weekend ahead.

Best regards,
Diego

1 Like