php-shopify
php-shopify copied to clipboard
"write_discounts" and "read_discounts" scopes not available?
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.
@brianruff This is late, but...
Two things: (also, I am not a Shopify expert 😃)
-
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?
-
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