-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Shopify wishlist implementation #724
Shopify wishlist implementation #724
Conversation
…flag, generated shopify admin api schema, changed RemoveItemHook of commerce/types/wishlist, created shopify wishlist api routes (addItem, removeItem, getWishlist), added shopify api operation getCustomerWishlist, updated index files of api/operations, utils and api/wishlist, created shopify wishlist types created getCustomerId function as a util in shopify added customerUpdate mutation, added customer query with admin api, added getCustomerId query
…/body, added useAdminApi flag to commerce fetcherOptions, updated wishlist api constants, modified shopify fetcher, added wishlist handlers to shopify provider Polished frontend UI so that you can now correctly add product to wishlist if variant is not available for sale
@chemmanouilidis is attempting to deploy a commit to the Vercel Solutions Team on Vercel. A member of the Team first needs to authorize it. |
This pull request is being automatically deployed with Vercel (learn more). commerce-local – ./site🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-local/4tMM9t6GzHEvFbqwnFRiJJELBWAH [Deployment for e81c0fb failed] commerce-bigcommerce – ./site🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-bigcommerce/J7v1CDEWHcfBgAZGGqm1msGfWepN [Deployment for 594b3ef failed] commerce-ordercloud – ./site🔍 Inspect: https://vercel.com/vercel-solutions-vtest314/commerce-ordercloud/2pPXTFgZt6ZQe6FFwmdsXv83TePB |
…e shopify admin access token to use shopify Admin API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution. It looks awesome and is a lot of work. Please see my comments and requests for changes.
Additional notes:
- we use
yarn
for this project, please removepackage-lock.json
- the main "local" build is failing
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Corrections Commit includes the following changes: ### Commerce API
### Shopify provider
Site Components
|
package lock removed. |
…kage, reverted tsconfig changes I made for develop testing.
…rd components as the default option for provider compatibility
now the main "local" build succeeds. |
@chemmanouilidis thanks for this PR. Is there any progress here, did you ever use this in production? |
I don't think any further progress is required. I currently use it in production and it seems stable. |
})! | ||
metafieldInput = { id: wishlist?.id! } | ||
} else { | ||
metafieldInput = { namespace: 'my_fields', key: 'wishlist' } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chemmanouilidis just a heads up, I believe you need a type: 'json'
on this metafieldInput
, otherwise the initial metafield API call will quietly fail and the Wishlist is never created.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope. It has been tested "as is" and works as intended. I use this implementation live without any problems so far.
The reason why you don't need this is because you don't actually create the Metafield. The metafield is created inside the settings section of your shopify store. By going to Settings > Metafields and choosing customers you define a Metafield for the customers field which is of json type. So every customer created already has the Wishlist metafield by default and it is of type JSON.
In the code block you mention, in order to add an item to the wishlist, I must first check if this customer's wishlist is already populated or not. There is a slight difference in the mutation if the list is already populated.
Hey there! Thank you for your contribution. We have decided to take Next.js Commerce in a new direction and will be closing out current PRs and issues due to this change. Please see this PR for more details: #966 |
Wishlist implementation for the Shopify provider. You can Add, Remove products to your customer wishlist as well as their variants. Also Added the possibility to add a specific product variant to your wishlist if its not available for sale (due to no stock etc)...
changed shopify fetch and graphQL fetch types and also the fetcher functions to include useAdminApiFlag in order to seperate graphql storefront API operations from Admin API ones,
generated shopify admin api schema(documentation for code generation is outdated and not working as per readme instructions - yarn generate:shopify script not present),
changed RemoveItemHook of commerce/types/wishlist,
created shopify wishlist api routes (addItem, removeItem, getWishlist),
added shopify api operation getCustomerWishlist,
updated index files of api/operations, utils and api/wishlist,
created shopify wishlist types ,
created getCustomerId function as a util in shopify ,
added customerUpdate mutation (Admin API operation), customer query (Admin API operation),
added getCustomerId query,
modified commerce wishlist endpoint to extract item variable from req/body,
added useAdminApi flag to commerce fetcherOptions,
updated wishlist api constants,
modified shopify fetcher,
added wishlist handlers to shopify provider ,
Polished frontend UI so that you can now correctly add product to wishlist if variant is not available for sale
modified .env.template files to correctly refer that you also need shopify admin access token