Switch Currency According to customer country.

Hello Shakeel,

the event name you subscribed to, was wrong. Also the typehint on your callback method. Here is the fix:

namespace Bc\BrandCrockCurrencySwitch\Subscriber;

use Shopware\Core\Checkout\Customer\Event\CustomerLoginEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class MySubscriber implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return[
            CustomerLoginEvent::class => 'onAccountLoaded'
        ];
    }

    public function onAccountLoaded(CustomerLoginEvent $event)
    {
        echo 'MySubscriber.php Zeile: 21';
        dd($event);

        // ...
    }
}

In most cases we only dispatch the event object through the Symfony EventDispatcher, therefore you have to subscribe to the class name of the event. 

Best regards from Schöppingen

cool Michael Telgmann

1 „Gefällt mir“