Vue-storefront: cart sync not working

Created on 26 Sep 2019  ·  13Comments  ·  Source: DivanteLtd/vue-storefront

Current behavior

I have added two products on my local Magento instance while being logged in.
I log into VSF and I don't see the items in the cart.
The items do show up in the api/cart/pull response, sometimes.

Steps to reproduce the issue

Sorry the gif is long, magento takes forever to respond
cartsync

Expected behavior

Cart on client should reflect what on server (I think)

Can you handle fixing this bug by yourself?

  • [ ] YES
  • [X] NO

Environment details

  • Browser: Chrome Version 77.0.3865.90 (Official Build) (64-bit)
  • OS: Windows 10 Pro 1809
  • Node: v10.16.3
  • Code Version: VSF 1.10.3 / VSF-API 1.10.0
Important QA approved after merge bug

All 13 comments

If it can help, these are the two items that are supposed to show up in cart

image

Let me know if I can provide more info

@undefinederror would you be so kind and test this scenario on “develop” branch?

Of course!

image

Seems like the "list" action returns no items, so nothing is added to client cart.
That sku doesn't look right, does it?
image

Could it be concatenating sku from all these "subproducts"?
image

Let me know if I can be more helpful

I just removed that one item, and now the cart syncs
image

I have re-added the item from VSF, I can see it in cart
image

cart/update payload has the short sku
image

response has the long sku
image

If I log in from and incognito tab I now see only the other item (being now first in the cart/pull it is added to the client cart before the long sku item fails)
image
And somehow totals don't add up.

So I think now the issue can at least be isolated to "configurable products"?

Yeah, we can't sync the bundle products this way - they never exist in the Elastic; it shouldn't cause the error though; it was introduced with Vuex refactor of cart sync in 1.10 and got fixed by @andrzejewsky in 1.11 and now needs to be ported to 1.10

currently, when the sync proces is interupted (by bundle product) the totals won't be also summed up we must better support exceptions in the cart/merge

@undefinederror Did you use the newest develop branch? Because very similar issue was fixed yesterday, basically in the same place.

Hint: check if the getProductVariant is in try/catch if not - then you need to fetch latest develop

I just checked out to develop this morning around 1:30 hrs ago, version 1.11.0-rc.1
getProductVariant has no try/catch

I'll have a better look in a couple of hours, after lunch.
Thank you for replying so quickly

it should look like this:

  async getProductVariant ({ dispatch }, { serverItem }) {
    try {
      const options = await dispatch('findProductOption', { serverItem })
      const singleProduct = await dispatch('product/single', { options, assignDefaultVariant: true, setCurrentProduct: false, selectDefaultVariant: false }, { root: true })

      return {
        ...singleProduct,
        server_item_id: serverItem.item_id,
        qty: serverItem.qty,
        server_cart_id: serverItem.quote_id,
        product_option: serverItem.product_option || singleProduct.product_option
      }
    } catch (e) {
      return null
    }
  }

:) Let us know if we can close this issue and by the same time @gibkigonzo has ported this bugfix to 1.10

yes, my bad, sorry, I did checkout to develop but I had forgotten to pull :(
I see the try/catch clause now, and the error in console is gone.

So, if I understand correctly, bundle products is something that currently cannot be rendered in client cart when the cart is sync'd from server. Is it something that I should implement myself (though I don't think I can) or is it that is planned to be supported in the future?

In case, can I add a feature request?

Thanks! Would be great if you'll like to implement this feature and raise a Pull Request; we haven't had this feature on our roadmap yet

Was this page helpful?
0 / 5 - 0 ratings