Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"write_discounts" and "read_discounts" scopes not available? #286

Open
brianruff opened this issue Jan 21, 2023 · 1 comment
Open

"write_discounts" and "read_discounts" scopes not available? #286

brianruff opened this issue Jan 21, 2023 · 1 comment

Comments

@brianruff
Copy link

brianruff commented Jan 21, 2023

It looks like Shopify is getting away from using Price Rules and using the 'write_discounts' and 'read_discounts' scopes primarily. I can't seem to get these scopes added using phpclassic/php-shopify. (All other scopes are working for me).

Here's my code that is crashing once I add the 'discount' scopes:

\PHPShopify\ShopifySDK::config($config); $scopes = 'read_products,write_products,read_customers,read_discounts,write_discounts'; $accessToken = \PHPShopify\AuthHelper::createAuthRequest($scopes);

There's a note on this page about it. Does anybody know why the php-shopify is crashing with you added "write_discounts, read_discounts" scope?

https://shopify.dev/api/admin-rest/2023-01/resources/discountcode

We recommend using the GraphQL Admin API to manage discounts. The Discount types available in the GraphQL Admin API are intended to replace the GraphQL Admin PriceRule object and REST Admin PriceRule and DiscountCode resources.

@Spotnyk
Copy link
Contributor

Spotnyk commented Jul 6, 2023

@brianruff This is late, but...

Two things:
(also, I am not a Shopify expert 😃)

  1. I've never seen anything in the code which limits what content can be used on a resource. This library is mainly an authentication and routing framework. If you are unable to request those scopes, it is likely on Shopify's side. They will generally give you a fair idea of why something is failing in their response body. Do you have that?

  2. Personally I've noticed that certain resources are only available on gQL. I get the (again, personally) feeling they really would prefer to sunset the REST API completely. They may be slowly removing support for resources from REST on purpose. I did notice before reading your post that Discounts do seem to be primarily supported on gQL now. However, I do not see how that would impact your ability to request scopes.

Hope this helps.
-S

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants