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

Products need 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 OOTB Habitat-environment. In the config-file we set EUR to be the default currency. USD was always just added as an option.

In my "Currency Configuration" I use the currency set "Default", which has "EUR" assigned as default currency.

Also all prices, that are assigned to the sellable items (wether list prices or price cards / price card snapshots), use just EUR as currency.

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);

UPDATE: I also noticed, that the cart always uses the list price to calculate the totals. That's a weird, because the price is calculated correctly based on the price card snapshots, when I use the PricingServiceProvider and it's GetProductPrices method. To assign price card snapshots to sellable items, we use tags. Maybe it's a problem when the cart tries to calculate the prices based on tags?

n-develop
  • 275
  • 1
  • 10