Closed Mosnar closed 4 years ago
So this is actually a constant, not a static property. I'm checking if this exists as per:
https://stackoverflow.com/questions/24159178/check-if-a-class-constant-exists
But I'm thinking that perhaps it needs to be a fully qualified class name to work as expected.
I've changed it to:
// Check to make sure Order::EVENT_AFTER_REMOVE_LINE_ITEM is defined
if (defined(Order::class . '::EVENT_AFTER_REMOVE_LINE_ITEM')) {
Event::on(Order::class, Order::EVENT_AFTER_REMOVE_LINE_ITEM, function (LineItemEvent $e) {
$lineItem = $e->lineItem;
if (self::$settings->autoSendRemoveFromCart) {
$this->commerce->removeFromCart($lineItem->order, $lineItem);
}
});
}
Can you try it out and lmk if this solves it for you? Change your semVer
to dev-develop
-> https://github.com/nystudio107/craft-instantanalytics/commit/afa461f2d468905281a56013e93a254959bd7af8
I'm not sure exactly what's going on here, but this
defined
check never evaluates truthfully. I've never seen this syntax for checking if a static property exists, so I'm thinking it's an error?https://github.com/nystudio107/craft-instantanalytics/blob/ae947132219a78f945ffebd94113b8d9e5fec032/src/InstantAnalytics.php#L294-L300
Removing the check allows the events to trigger as expected.
Craft Commerce: 3.1.12 Pro