You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var testVariationContextBefore = _variationContextAccessor.VariationContext?.Culture;
_umbracoCommerceApi.Uow.Execute(uow =>
{
var order = _umbracoCommerceApi.GetCurrentOrder(storeId)
.AsWritable(uow);
//Finalize order
order.InitializeTransaction();
order.Finalize(order.TotalPrice, Guid.NewGuid().ToString("N"), PaymentStatus.Authorized);
_umbracoCommerceApi.SaveOrder(order);
uow.Complete();
});
var testVariationContextAfter = _variationContextAccessor.VariationContext?.Culture;
And being on e.g. an english variant, the testVariationContextBefore variable will have a value of en, but testVariationContextAfter will have a value of da, as danish is the default variant.
Something is happening in InitializeTransaction() and/or Finalize() so variationContext is set to default.
If any redirection happen after finalizing, for example to a receipt page, the user will be redirected to the incorrect variant.
A temporary work around is fetch the variationContext prior to calling InitializeTransaction() and Finalize(), and then set it before redirections, so something like this
var currentVariationContext = _variationContextAccessor.VariationContext?.Culture;
_umbracoCommerceApi.Uow.Execute(uow =>
{
var order = _umbracoCommerceApi.GetCurrentOrder(storeId)
.AsWritable(uow);
//Finalize order
order.InitializeTransaction();
order.Finalize(order.TotalPrice, Guid.NewGuid().ToString("N"), PaymentStatus.Authorized);
_umbracoCommerceApi.SaveOrder(order);
uow.Complete();
});
_variationContextAccessor.VariationContext = new VariationContext(currentVariationContext);
return RedirectToUmbracoPage(receiptPage);
Umbraco 13.1.1
Umbraco Commerce 13.1.3
The text was updated successfully, but these errors were encountered:
When doing something like this
And being on e.g. an english variant, the
testVariationContextBefore
variable will have a value ofen
, buttestVariationContextAfter
will have a value ofda
, as danish is the default variant.Something is happening in
InitializeTransaction()
and/orFinalize()
so variationContext is set to default.If any redirection happen after finalizing, for example to a receipt page, the user will be redirected to the incorrect variant.
A temporary work around is fetch the variationContext prior to calling
InitializeTransaction()
andFinalize()
, and then set it before redirections, so something like thisUmbraco 13.1.1
Umbraco Commerce 13.1.3
The text was updated successfully, but these errors were encountered: