Feature: Storefront GraphQL Requests #308
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I propose adding a new feature to the library enabling users to interact with the Shopify Storefront GraphQL API. This API necessitates an alternative endpoint for authenticated requests:
https://my-store.myshopify.com/api/2023-04/graphql.json
.Key Modifications:
lib/ShopifyResource.php
:__construct()
to accept and set a new configuration variableStoreFrontAccessToken
, obtainable via Shopify Admin under "Private App" setup.lib/GraphQL.php
:storefront()
method, mirroringpost()
method’s signature. If$url
argument remains unset, it assembles the correct Shopify GraphQL storefront URL for requests.Example Usage:
Motivation:
I Encountered a scenario requiring product locale translations retrieval for a client's store. The existing Shopify Admin GraphQL API fell short, necessitating the Storefront API. I appreciate the ease of use this library brings and think this feature would be beneficial to the developers that work with this great library.
I appreciate any feedback and am open to making any necessary changes. Thank you for considering this enhancement!