Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Populate a WorkContext in the created scope (#124)

KrzysztofPajak910a249fdb6d
diff --git a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
index 9fc01dfa4..0c79b5010 100644
--- a/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
+++ b/src/Business/Grand.Business.Checkout/Commands/Handlers/Orders/PlaceOrderCommandHandler.cs
@@ -1106,6 +1106,12 @@ namespace Grand.Business.Checkout.Commands.Handlers.Orders
{
using var scope = scopeFactory.CreateScope();
+ var workContext = scope.ServiceProvider.GetService<IWorkContext>();
+ await workContext.SetCurrentCustomer(customer);
+ await workContext.SetWorkingLanguage(customer);
+ await workContext.SetWorkingCurrency(customer);
+ await workContext.SetTaxDisplayType(customer);
+
var orderService = scope.ServiceProvider.GetRequiredService<IOrderService>();
var messageProviderService = scope.ServiceProvider.GetRequiredService<IMessageProviderService>();
var orderSettings = scope.ServiceProvider.GetRequiredService<OrderSettings>();