Anyone that have successfully implemented klarna checkout V3 in a channel that is hosting both B2B and B2C customers?
For us the checkout isn’t behaving in a consistent manner and the setting that we apply in KlarnaCondigv3 isn’t always applied. Sometimes it works if you reload the checkout page and sometimes not.
We have added AllowedCustomerTypes = new List { CustomerTypePerson, CustomerTypeOrganization}
But if logged in we want only organization or person to be available depending on the customer.
We also want to populate organization number for B2B customers automatically in the klarna checkout.
So if logged in and b2b customer we apply below code to set customer type to organization and remove the person option from allowed.
First of OrganizationId is never applied in the klarna checkout and secondly you usually have to select organization and enter a organization number before the klarna checkout removes the option to select person.
If i look at what is logged by klarna plugin i see 3 klarna snippets logged each time I reload the checkout page.
- Looks lite cart fetched from klarna
- Looks like our setting applied to klarna cart
- Response from applying options
the 3. response usually don’t include any of the changes we set in the klarnaconfig3v file unless we reload the checkout page.
- Sometimes include settings we set in 2. if we reload the checkout page.
Since the behaviour of the klarna checkout is some what random we haven been able to pinpoint where to start troubleshooting this. Only thing that are really consistent is that organization number is never applied in klarna checkout.
Anyone the tried to implemented B2C and B2B in same channel and had similar problems that you solved?
For me it feels like first time you visit the checkout the foundation for the klarna checkout is set and after that it is hard to apply other rules to that cart unless you clear cookies and start over.
if (orderCarrier.CustomerInfo != null && orderCarrier.CustomerInfo.PersonID != Guid.Empty)
{
klarnaCheckoutOrder.CheckoutCustomer = new CheckoutCustomer();
if (orderCarrier.CustomerInfo.OrganizationID != Guid.Empty)
{
// Customer is B2B customer
var organization = _organizationService.Get(orderCarrier.CustomerInfo.OrganizationID);
if (organization != null)
{
klarnaCheckoutOrder.CheckoutCustomer.OrganizationRegistrationId = organization.Fields.GetValue<string>(CustomerFieldNames.LegalRegistrationNumber);
}
klarnaCheckoutOrder.CheckoutCustomer.Type = CustomerTypeOrganization;
klarnaCheckoutOrder.CheckoutOptions.AllowedCustomerTypes.Remove(CustomerTypePerson);
}
else
{
// Customer is B2C customer
klarnaCheckoutOrder.CheckoutCustomer.Type = CustomerTypePerson;
klarnaCheckoutOrder.CheckoutOptions.AllowedCustomerTypes.Remove(CustomerTypeOrganization);
}
}
Litium version: 7.6.1