-
Notifications
You must be signed in to change notification settings - Fork 220
Update cart API response and data store to contain product type #10825
Conversation
The release ZIP for this PR is accessible via:
Script Dependencies ReportThe
This comment was automatically generated by the TypeScript Errors Report
🎉 🎉 This PR does not introduce new TS errors. |
Size Change: +19 B (0%) Total Size: 1.44 MB
ℹ️ View Unchanged
|
{ | ||
"key": "9bf31c7ff062936a96d3c8bd1f8f2ff3", | ||
"id": 15, | ||
"type": "simple", |
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.
This and line 109 are the only lines that changed in this file, not sure why the diff is showing the entire file.
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.
Code checks out, tested with Simple, grouped, variable, subscription, and variable subscription.
sorry I don't know if i am in the right place, but does woocomerce have an api for cart now? |
Hi @Uny1me we have Store API which lets you interact with the Cart, Checkout, and Products via a REST API. This is different to the WooCommerce REST API. The documentation can be found at https://github.com/woocommerce/woocommerce-blocks/blob/trunk/src/StoreApi/README.md and the "Resources and Endpoints" section may be of particular interest to you. |
Hey @opr thanks for taking the time to respond, sorry for my late response in turn. I am building an app using flutter x wordpress&woocomerce rest API, and for cart, I am currently using the cocart plugin, which also comes with jwt auth that I am using to authenticate my app. I was studying the docs for store api and wanted to understand how i'll be able to use this endpoint for each user, looked at the authentication.php file and it seems cookies are being used, since my auth is from cocart, I'm not sure how this would work becasue on testing an empty cart is returned. how can i go about switching, do i have to generate a unique nonce for each user, how will I authenticate as well, p.s if you know anything on google/apple auth for the app, please let me know, get back to me when you can please |
What
This PR adds the product type to the data store and API response.
Why
To accurately report the correct types of product in a cart when a store is opted-in to Jetpack WooCommerce Analytics.
Testing Instructions
Please consider any edge cases this change may have, and also other areas of the product this may impact.
wc/store/cart
store./wp-json/wc/store/v1/products
and check thetype
of each product is correctly reported.Screenshots or screencast
N/A
WooCommerce Visibility
Required:
Checklist
Required:
[type]
label or a[skip-changelog]
label.Conditional:
[skip-changelog]
label is not present).Please note that #10824 has been opened to fix the documentation issue with the external product
Changelog