magento2-ordercomments icon indicating copy to clipboard operation
magento2-ordercomments copied to clipboard

Managing checkout comment REST API

Open reshadzazai opened this issue 4 years ago • 1 comments

I have created the cart --> https://example.com/rest/us/V1/carts/mine Added Products ---> https://example.com/rest/us/V1/carts/mine/items Now, I want to add the comment so I used the below API: PUT https://example.com/rest/us/V1/carts/mine/set-order-comment?cartId=841xx Body JSON: { "orderComment": "The is test comment" } Response 200 OK [] Then I follow the process and place the order but when looking at the orders in the admin grid the comment is not there. I have tested the comment through the website and it is working but it does not work through APIs.

In app\code\Bold\OrderComment\Model\OrderCommentManagement.php Line 52 : $comment = $orderComment->getComment(); The $comment variable has a NULL value.

Magento 2.3.6

reshadzazai avatar Mar 03 '21 19:03 reshadzazai

For all those who struggle with this issue, the comment has to be provide in the following format in JSON Body: { "cartId": "84XXX", "orderComment": { "comment": "The is test comment" } }

reshadzazai avatar Mar 04 '21 18:03 reshadzazai