Recent Topics

How can override category observer in new package ?



  • How can override category observer?



  • Hi @zainawan99,

    The mentioned class has been registered in the Category package provider's method. You can just change the class name there and then extend the one which you need the override.

    For e.g.,

    In packages/Webkul/Category/src/Providers/CategoryServiceProvider.php, you can do something like this,

    public function boot()
    {
        ...
    
        CategoryProxy::observe(YourObserver::class);
    
        ...
    }
    

    Then here,

    class YourObserver extends CategoryObserver
    { ... }
    

    Then afterwards, it's your choice whether you want to override or not.


Log in to reply