Override a service in plugin

Il y a 1 mois
Hi A.m,
I want to override GetWorkingCurrencyAsync() method in WebWorkContext from my plugin. The purpose of plugin is get currrency by customer role. I created the plugin
public class CustomWebWorkContext : WebWorkContext
then ı override the method.
public override async Task<Currency> GetWorkingCurrencyAsync()
in plugin's nopstartup ı created a scope
services.AddScoped<WebWorkContext, CustomWebWorkContext>();
and value of the order is 10000 but when ı debug the code plugin doesnt work. +

I read the topic about that
1. Create your custom new class derived from OrderProcessingService
2. Override the CheckOrderStatus  method
3. Create a new class implementing from IDependencyRegistrar. Set its "Order" property to some big value so it's run after the default one
4. Register your new custom class as IOrderProcessingService.
Il y a 1 mois
What version of nopCommerce?
Do you have a NopStartup.cs?

See example
\Plugins\Nop.Plugin.Misc.Sendinblue\Infrastructure\NopStartup.cs
Il y a 1 mois
Thanks for answer but that was my bad. My constructor was wrong. I fixed it and now plugin is working.