In Craft Commerce 1, there is documentation on how to re-order adjustments that do similar things. https://docs.craftcms.com/commerce/v1/adjusters.html#ordering-adjustments

But I don't see any similar documentation for how to do that in Commerce 2.

I have 2 plugins that make adjustments to the Sale price and then Order total, but if run in the wrong order, it doesn't work.

Simple solution is to uninstall the plugins and install them in the correct sequence, but was wondering if there was still a way to force them to run in a certain order.

1 Answer 1


Looking at the \craft\commerce\services\OrderAdjustments you should be able to change the ordering of your adjustments by using the \craft\commerce\services\OrderAdjustments::EVENT_REGISTER_ORDER_ADJUSTERS event.

use craft\events\RegisterComponentTypesEvent;
use craft\commerce\services\OrderAdjustments;
use yii\base\Event;

    function (RegisterComponentTypesEvent $e) {
        $e->types = [
            // Add the adjusters in whatever order you want here. Leaving this empty would disable all adjusters.
  • So I'm using the Verbb Gift Voucher plugin in conjunction with my custom one. You're saying when I register my Adjuster, it should look something like: $event->types = [ GiftVoucherAdjuster::class, CartAdjustmentsAdjuster::class ]; Commented Mar 5, 2019 at 21:16
  • Actually, I need the Gift Vouchers Adjuster to run before my CartAdjustementAdjuster. Doing this in my plugin, then disabling and enabling the 2 plugins again doesn't seem to work. Do I have to uninstall and install again? Then I'm back to square one and just easier to install in the correct order. Commented Mar 6, 2019 at 3:11
  • finally figured out that I had to add use verbb\giftvoucher\adjusters\GiftVoucherAdjuster; at the top of the file. Now I can use the code as @Maarten mentioned. It ends up looking like $event->types = [ CartAdjustmentsAdjuster::class, GiftVoucherAdjuster::class ]; Commented Mar 8, 2020 at 1:38
  • Thanks for sharing, Marc! Commented Mar 10, 2020 at 19:03

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.