Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

REST API: Cart and Checkout Block Requirements #1312

Closed
6 tasks done
mikejolley opened this issue Dec 3, 2019 · 8 comments
Closed
6 tasks done

REST API: Cart and Checkout Block Requirements #1312

mikejolley opened this issue Dec 3, 2019 · 8 comments
Assignees
Labels
focus: rest api Work impacting REST api routes. status: blocker Used on issues or pulls that block work from being released. type: epic A label used by Zenhub for indicating issues functioning as an Epic.

Comments

@mikejolley
Copy link
Member

mikejolley commented Dec 3, 2019

In order for the cart and checkout blocks to become functional, a series of APIs will be required to interact with the server and WooCommerce data.

Many of these APIs do not exist, and current code in core is not flexible enough to handle these scenarios due to it being tightly coupled to the existing cart and checkout.

The following APIs will be added to the Store API in the blocks plugin. APIs will require customer context, so like the current cart API, this will use the current logged in user, or customer session cookie for guests.

Unanswered Questions/Notes:

  1. Do we need an API to get checkout fields, or do we handle that client side? Core handles "locales" based on selected country where labels and field positions are updated. For example, renaming state -> county, or hiding certain non-applicable fields.
  2. Newsletter signup is included in the mocks but it's not clear how that data will be used. We could store it to customer meta using the customer API and allow plugins to read it in a standardized way?
  3. We need to explore what totals are needed in the cart, looking to core and the mockups. For example, subtotal, taxes, discount total etc.

TODO
- Payment Methods API - Lists available/registered payment methods. Used by the cart to show a payment methods list (icons only), and used by the checkout to show available express and regular payment methods. See #1321

@mikejolley mikejolley added status: blocker Used on issues or pulls that block work from being released. focus: rest api Work impacting REST api routes. labels Dec 3, 2019
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label type: feature request to this issue, with a confidence of 0.84. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@nerrad
Copy link
Contributor

nerrad commented Dec 3, 2019

I'll give some more fuller feedback at some future point but initially thought I'd ask, is there any prior art that we can learn/draw from as we deliberate this? Any work that WP.com has done or other ecommerce applications?

@haszari
Copy link
Member

haszari commented Dec 3, 2019

Lots more exploration to do on all these endpoints, as you say @mikejolley each endpoint is a significant chunk of work.

The only feedback I have right now is the low-stock API, I'm thinking this should probably return a boolean based on the threshold, rather than raw stock numbers. Stock quantity is not actually needed, and we're replicating server logic – probably safest to keep this API focused on the essential need. Another option would be to include the low_stock attribute in a different API response, e.g. cart state (rather than its own api).

Edit: I see that the stock count is on product pages in core, so probably no need for the boolean attribute, stock count is good fit :)

Screen Shot 2019-12-04 at 1 40 24 PM

@haszari
Copy link
Member

haszari commented Dec 4, 2019

Let's discuss the APIs needed for the Cart block in #1213 .

@mikejolley
Copy link
Member Author

@nerrad This is a good prior art for shipping rates: https://help.shopify.com/en/themes/development/getting-started/using-ajax-api cc @haszari

So assuming we used the in-session cart, we'd just send the customer address and get back rates. /cart/shipping-rates makes sense.

Any work that WP.com has done or other ecommerce applications?

Not familiar with their APIs but looking at docs it doesn't seem to cover eCommerce usage.

@mikejolley mikejolley added type: epic A label used by Zenhub for indicating issues functioning as an Epic. and removed type: feature request labels Dec 4, 2019
@mikejolley
Copy link
Member Author

Shipping rates: #1318

@mikejolley mikejolley changed the title Cart and Checkout Block: REST API Requirements REST API: Cart and Checkout Block Requirements Dec 4, 2019
@nerrad
Copy link
Contributor

nerrad commented Dec 4, 2019

@woocommerce/blocks @mikejolley has agreed to take point on this epic but he is still going to need help. If you are willing to help him get this epic done please assign yourself to the epic (it's okay to have multiple peeps on it). That helps Mike know who he can ping too if necessary.

@haszari
Copy link
Member

haszari commented Dec 4, 2019

Added an issue for cart totals: #1324

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
focus: rest api Work impacting REST api routes. status: blocker Used on issues or pulls that block work from being released. type: epic A label used by Zenhub for indicating issues functioning as an Epic.
Projects
None yet
Development

No branches or pull requests

3 participants