Thursday, July 26, 2018

Sitecore Experience Commerce - InvalidShopCurrency error on site publish

When attempting to perform a site publish (to the web database) on a Sitecore instance containing Experience Commerce, the following error occurred part way through the publish:
Job started: Publish to 'web'|#Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.OData.Client.DataServiceQueryException: An error occurred while processing this request. ---> Microsoft.OData.Client.DataServiceClientException: { "@odata.context":"https://localhost:5000/Api/$metadata#Sitecore.Commerce.Core.CommandMessage","MessageDate":"2018-07-25T20:38:11.802773Z","Code":"Error","Text":"Currency 'NZD' for Shop 'MyShop' was not found.","CommerceTermKey":"InvalidShopCurrency"}
This issue relates to the fact that that environment was configured (via the configuration in the commerce engine) to be using NZD (New Zealand dollars) as a currency. The issue then relates to the commerce engine being able to retrieve the currency settings from the Sitecore instance.

This traces back to the shared default currency setting in Sitecore (/sitecore/Commerce/Commerce Control Panel/Shared Settings/Currency Settings/Currency Sets/Default) which OOTB is not set to NZD and does not have NZD configured at all. Updating this and then restarting the commerce engine environment (due to caching) resolved the error.

Sitecore Experience Commerce - Default currency settings

No comments:

Post a Comment