Skip to main content
1 of 4
n-develop
  • 275
  • 1
  • 10

Products needs USD price to be added to cart

I'm using Sitecore 9.0 Update 1 and XC9 Update 1 in a project for a european customer.

We created our own environment, based on the Habitat-environment. In the config-file we set EUR to be the default currency. USD was always just added as an option.

But when I try to add a product to the cart, that does not have a USD-price assigned, I get the following error in the commerce engine log:

ERROR CtxMsg.Error.LineIsNotPurchasable: Text=Item 'My Product' is not purchasable.

But if I add a price with currency "USD", it works fine. I assume, I'm doing something wrong, sadly I wasn't able to figure out what it is.

I use the CartServiceProvider from the Sitecore.Commerce.Connect.Core.dll and use it's AddCartLines method.

Here is a simplified version of the code:

var currency = "EUR";
var cartLine = new CommerceCartLine(catalog, product.ProductId, null, product.Quantity);
var request = new AddCartLinesRequest(cart, new[] { cartLine })
{
    CurrencyCode = currency,
    Shop = new Shop { Name = Consts.ShopName }
};

_cartServiceProvider.AddCartLines(request);
n-develop
  • 275
  • 1
  • 10