I was able to sign in using /rest/V1/integration/customer/token and add items to cart. How do I view the cart(items I added using REST API) from front-end?
-
refer this answer magento.stackexchange.com/questions/183526/…Nagaraju Kasa– Nagaraju Kasa2020年01月25日 14:33:59 +00:00Commented Jan 25, 2020 at 14:33
1 Answer 1
just make get request to
V1/carts/mine/items
You should get a json response with the data.
The cart needs to be create first, you do that by posting to
V1/carts/mine
-
This doesn't answer the question at all.OP wants to view the cart in the Magento storefront, not list the items in the API.Doug McLean– Doug McLean2019年05月21日 09:14:59 +00:00Commented May 21, 2019 at 9:14
-
@DougMcLean the store front doesn't use rest api... storefront != frontend..Mackelito– Mackelito2019年05月22日 10:52:29 +00:00Commented May 22, 2019 at 10:52
-
Magento themselves treat the two terms as synonymous, pretty much: see devdocs.magento.com/guides/v2.3/architecture/archi_perspectives/…. But we are at risk of arguing over semantics. My understanding of the question is that OP wants to generate a cart via the API, add items to it via the API, but then link to the storefront and have that cart shown there. It's a requirement I've seen before: browse and pick via an app, but then be sent to a single point of checkout (the storefront) to complete the order.Doug McLean– Doug McLean2019年05月22日 15:40:46 +00:00Commented May 22, 2019 at 15:40
-
1I see your point.. And magento should use the term more visely as the store front is made from both backend (PHP) and frontend (HTML/JS/CSS).. Guess we just assume different things.. OP talked about managed to login using rest so I was just assuming that he/she was talking about making at xhr request to post cart items and then retrieving them in the same way :)Mackelito– Mackelito2019年05月24日 05:23:32 +00:00Commented May 24, 2019 at 5:23
-
1Guess it´s good that we post about both options here as comments :)Mackelito– Mackelito2019年05月24日 05:25:50 +00:00Commented May 24, 2019 at 5:25
default