posting to rest/V1/guest-carts/items
the following
{
"cartItem": {
"cartId": "88b361f4da84440a31edb3a568534242",
"qty":1
}
}
get error message
message: "Property "CartId" does not have corresponding setter in class "MagentoQuoteApiDataCartItemInterface"."
Added cartId as endpoint asked for it, trying to work out the required data, but rest documentation is still poor.
Ok have to use quote_id but what is quote_id ? don't see any end points to create one, setting quote_id to cart id works but that is so confusing if that is correct.
And price why do i need to set a price on the request of adding the item to the cart?
@mad0house thank you for your question.
Price should not be needed to add an item to the cart (only quote_id, sku and qty are required), please check if payload described in this article works for you.
Regarding cart creation, this service may be used. On successful request it will return quote_id which may be used for other cart operations.
Ok this does work and you don't have to set prices,
but when you return items using /default/V1/guest-carts/0e1d92cc27977917131eb61e2d933d09/items
the prices are 0,
Do then need to do the math my self to work out the correct pricing(and further rest calls) if I was going to show this customer? seems a little error prone. Would of expected this to be the correct price for the qty and any options which may have been added.
Generally item prices should be returned correctly, same as they are shown on the storefront in the cart.
I have tried to reproduce the problem you've described with the stock magento configuration and a simple product and it worked correctly. Could you please specify steps you performed to get the response with zero prices (e.g . product type and price, any settings which may affect prices, etc.)?
Will do give me a few days as currently away
@mad0house did you have a chance to check it again on latest version?
Testing this now, been a little snowed under.
@piotrekkaminski @ishakhsuvarov sorry it took so long, still does not work using latest from 5 days ago
Standard product called Test Product price 拢25.00
call
POST rest/V1/guest-carts/items
with
{"cartItem": {"sku": "test_product", "qty": 1, "quote_id": "6ae0cd64513b7e0917b58002dcf2bac7"}}
Get back
{"item_id":1,"sku":"test_product","qty":1,"name":"Test Product","price":0,"product_type":"simple","quote_id":"4"}
Price is wrong here as it should not be 0, expecting 25
Then lets check the cart to see if it has the correct price so
GET rest/V1/guest-carts/6ae0cd64513b7e0917b58002dcf2bac7/items
and in return i get back
[{"item_id":1,"sku":"test_product","qty":1,"name":"Test Product","price":0,"product_type":"simple","quote_id":"6ae0cd64513b7e0917b58002dcf2bac7"}]
price is also 0 here what is wrong
Reopening and creating internal ticket - MAGETWO-44615 .
Internal ticket MAGETWO-44615 is closed and delivered to mainline. Please, let us know if you still have an issue.
@ishakhsuvarov Can you write here what should be in requests because that articles are not available anymore...
Is there some documentations where is written all requests with returns? Because for example
rest/V1/guest-carts returns some token for example - "08298c64bc1e71387e7f443707c8bd28" what is it?
Then this rest/V1/guest-carts/08298c64bc1e71387e7f443707c8bd28 returns me information about cart (id:10)
Then how I can add item to this cart?
How I can get quoteId?
and also
/V1/guest-carts/10/items - missing cartId param ("fieldValue": null)
/V1/guest-carts/08298c64bc1e71387e7f443707c8bd28/items - missing cartId param ("fieldValue": "10")
Thank you... I am starting to be crazy about it :)
@RUjmiak @mackelito, you might have a look here : #7542
Most helpful comment
@ishakhsuvarov Can you write here what should be in requests because that articles are not available anymore...
Is there some documentations where is written all requests with returns? Because for example
rest/V1/guest-carts returns some token for example - "08298c64bc1e71387e7f443707c8bd28" what is it?
Then this rest/V1/guest-carts/08298c64bc1e71387e7f443707c8bd28 returns me information about cart (id:10)
Then how I can add item to this cart?
How I can get quoteId?
and also
/V1/guest-carts/10/items - missing cartId param ("fieldValue": null)
/V1/guest-carts/08298c64bc1e71387e7f443707c8bd28/items - missing cartId param ("fieldValue": "10")
Thank you... I am starting to be crazy about it :)