SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
285 stars 138 forks source link

[BUG] User cannot add products to the cart after registering #1141

Closed breadadams closed 1 year ago

breadadams commented 1 year ago

Summary

As a user, if I visit the storefront and register a new account, I cannot add products to my basket.

Steps To Reproduce

  1. Visit the storefront in a new incognito window (this is key, as I've noticed that sometimes it works when I've started off in a session where I was logged originally - however there could be other scenarios where this bug is reproducible).
  2. Open the authentication modal via the header and register a new account *.
  3. Navigate to any PDP and add a product to the basket **.

* With the user registration, an API call to the ShopperBasket merge endpoint returns a 404 error:

{
  "title": "Basket Not Found",
  "type": "https://api.commercecloud.salesforce.com/documentation/error/v1/errors/basket-not-found",
  "detail": "No basket with ID '06ffae4a67b1432d59c28a287e' could be found.",
  "basketId": "06ffae4a67b1432d59c28a287e"
}

** When the add to basket POST request is made, it returns a 404 too:

{
    "_v": "21.3",
    "fault": {
        "arguments": {
            "basketId": "06ffae4a67b1432d59c28a287e"
        },
        "type": "BasketNotFoundException",
        "message": "No basket with ID '06ffae4a67b1432d59c28a287e' could be found."
    }
}

Expected result

The product should be added to the basket correctly.

Actual result

The product is not added to the basket (although the success modal opens). The only way to be able to add products to the basket again is by manually refreshing the page.

System Information (as applicable)

Browser: Chrome Node version: 14 pwa-kit version: 2.7.0 Desktop OS: macOS Mobile Device Info:

Additional information

https://user-images.githubusercontent.com/5795227/233076022-f20dce19-545d-4a57-8ca0-57c0863af44a.mov

breadadams commented 1 year ago

ℹ️ Please note I originally reported that you have to first add products to the basket in order to reproduce the bug, however that is not the case. I've updated the description above to reflect this.

bfeister commented 1 year ago

@breadadams thanks for reporting... I'm able to reproduce and will follow up.

vcua-mobify commented 1 year ago

I think this issue has been fixed in our develop branch by this PR: #1048

At the very least, while I can reproduce the issue on https://pwa-kit.mobify-storefront.com/ I cannot reproduce the issue on a local build off the develop branch with #1048 .

vcua-mobify commented 1 year ago

This is fixed in release 2.7.1