I have created an Adjuster which is attached to commerce_lineItems.onPopulateLineItem.

The discount criteria is based on validation of a completely separate coupon API, so I created a permission-less user group in order to allow my client to continue using the Commerce Discounts UI. In my adjuster, I had to override the the matchLineItem() method in order to bypass the $discount->allGroups check. I'm using Craft's httpSession to persist the criteria through the checkout process.

Everything works fine, however if the user adds a product to the cart and THEN authenticates, the discount doesn't get applied until they either a.) update the cart or b.) raise the commerce_lineItems.onPopulateLineItem event again.

I've tried adding craft()->commerce_orders->saveOrder($cart) at the end of a successful API call, however that doesn't seem to trigger the event. Is there another event I can use that will also update the cart or can I somehow raise an already declared CEvent? I've tried everything I know including hitting actionUpdateCart() with Guzzle!

I know this is a very edge case situation, so just to (briefly) illustrate I've added a portion of my base plugin below.

public function init()
    require_once __DIR__ .'/vendor/autoload.php';
     Load Premium Member Adjusters if $is_premium_member is true
    craft()->on('commerce_lineItems.onPopulateLineItem', function($event){

        $lineItem    = $event->params['lineItem'];

        if ($lineItem->purchasable instanceof Commerce_VariantModel){
            if ($this->is_premium_member) {
                $this->adjusters = [
                  599 => new WorkshopAdjuster

1 Answer 1


I've built a plugin which uses it's own events before, I guess the way to do it would be the same for separate plugins, however this is untested for your use case.

This should go in your plugin service

// Import the event from the other plugin

/Initialise the plugins event and pass whatever is required to it.
$event = new OtherPluginEvent($this, array('request' => $request));

// Raise it.
$this->raiseEvent('OtherPluginEvent', $event);

Again I haven't tried this from the context of calling another plugins event, but that is what I do from a plugins own event...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.