spartacus 4.2.1 B2B site in CX 2105.3 not able to add to cart

Viewed 83

I'm new to Spartacus. When I try to add a product to the cart. I'm getting the following message. enter image description here The error occurs in the anonymous user and Logged in User.

I have tried what in the Spartacus documentation has ben written. But I haven't been able to fix it. I also tried to give all authentication to a user in the backoffice. But didn't help.

1 Answers

It's hard to say without seeing the error message from OCC call for adding to cart (you can check it e.g. by opening of Chrome DevTools -> Network tab).

From top of my head: Currently, for B2B storefront, you need to use the B2B variations of the OCC endpoints - see defaultB2bOccConfig. Perhaps you're missing the B2B-flavoured configuration of OCC endpoints in your Spartacus app. Please try providing in your app module (or in your SpartacusConfigurationModule):

import { defaultB2bOccConfig } from "@spartacus/setup";

/* ... */


providers: [
  /* ... */,
  provideConfig(defaultB2bOccConfig)
] 
Related