vuestorefront / magento2

Vue Storefront 2 integration for Magento 2
https://docs.vuestorefront.io/magento
MIT License
170 stars 116 forks source link

[Bug]: Can't get data cart, when in cart have product out of stock. #235

Closed DaiLoc5698 closed 2 years ago

DaiLoc5698 commented 2 years ago

Expected Behavior

No response

Actual Behavior

api return response cart data like this, it have both data and errors. but in deep vsf use the error caching step, then return errors and data = null.

Possible Solution

Handle errors globally - add notification in Ui when API returns errors

Steps to reproduce

No response

What version of Magento 2 integration are you using?

1.0.0-rc.4.1

What version of Node.js are you using?

v.14.17.0

What browser (and version) are you using?

Chrome

What operating system (and version) are you using?

macOS

Relevant log output

No response

Code of Conduct

sync-by-unito[bot] commented 2 years ago

➤ Marcin Kwiatkowski commented:

It’s merged to develop branch.

sync-by-unito[bot] commented 2 years ago

➤ Igor Wojciechowski commented:

Tested locally on develop branch

Result: ❓ Comment: Though it seems that an issue is somewhat fixed, when I try to add a new product to the cart with OOS item, I get the “Some of the products are out of stock.” error and cart is being emptied (guest user) or nothing happens (logged-in user). Shall we maybe fix this issue as well in this ticket? Steps:

  1. Open session as a guest user
  2. Add product to cart
  3. Change stock status of product in cart to “Out of Stock” in M2 admin panel
  4. Add another product to the cart → the cart is then being cleared

Request and response:

POST /api/magento/addProductsToCart HTTP/1.1 Host: 192.168.131.17:3000 Content-Length: 92 Accept: application/json, text/plain, / User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4504.0 Safari/537.36 Content-Type: application/json;charset=UTF-8 Origin: http://192.168.131.17:3000 Referer: http://192.168.131.17:3000/default/c/gear.html Accept-Encoding: gzip, deflate Accept-Language: en,pl-PL;q=0.9,pl;q=0.8,en-US;q=0.7 Cookie: vsf-store=default; vsf-currency=USD; vsf-locale=default; vsf-country=US; vsf-cart=32sOTB39No5VZXjqFhGCYwcWbEj6UXV7 Connection: close

[{"cartId":"32sOTB39No5VZXjqFhGCYwcWbEj6UXV7","cartItems":[{"quantity":1,"sku":"24-WG02"}]}]HTTP/1.1 200 OK X-Powered-By: Express Access-Control-Allow-Origin: * Content-Type: application/json; charset=utf-8 Content-Length: 286 ETag: W/"11e-7TaFIZ+BlUpafPlek4KEeQ+PeDo" Date: Mon, 17 Jan 2022 13:22:56 GMT Connection: close

{"graphQLErrors":[{"message":"Some of the products are out of stock.","extensions":{"category":"graphql-input"},"locations":[{"line":42,"column":7}],"path":["addProductsToCart","cart","items",0]}],"clientErrors":[],"networkError":null,"message":"Some of the products are out of stock."}Bartosz Herba Marcin Kwiatkowski

sync-by-unito[bot] commented 2 years ago

➤ Bartosz Herba commented:

Marcin Kwiatkowski

This PR should solve this problem https://github.com/vuestorefront/magento2/pull/429 ( https://github.com/vuestorefront/magento2/pull/429|smart-link )