I've run accross an issue that seems like a bug to me and I'm desperately looking for some help to solve it.

I've created user groups in Craft & Discounts applicable to those user groups in Craft Commerce.

  1. a user lands on the site and adds items to his cart & proceeds to checkout
  2. the user is prompted to login or register
  3. the user logs in OR registers 3a. upon registration the user is activated & auto logged in with the 'autoLoginAfterAccountActivation' => true config option
  4. the user is redirected back to his cart - at this point in time I'm expecting to see a discount adjustment on the cart

The problem is that there is no discount adjustment on the cart - the only way the discount adjustment kicks in is if the cart is updated, by adding or removing an item ie: updateCart is fired.

I've double checked my discount rules & they are definitely setup correctly - the problem is that the users cart is "remembered" from before he was registered ie: before he was part of a user group that is eligible for a discount.

I'm looking for a way to "force" a cart refresh of some sorts.

1 Answer 1


I have confirmed this would indeed appear to be a bug in Commerce.

A quick workaround would be to listen to login events and call some sort of update cart hack, but this is really a fix that should happen at the Commerce end of things.

I'll report it.

EDIT: Luke Holder comfirms he's found the bug and it will be fixed in the next point release coming soon.

  • Any suggestions on the update cart hack ? Have tried the following on login: * adding & removing items from cart eg: craft()->commerce_cart->removeFromCart(...) craft()->commerce_cart->addToCart(...) * updating the cart using saveOrder eg: craft()->commerce_lineItems->updateLineItem(...) $order->setShouldRecalculateAdjustments(true); craft()->commerce_orders->saveOrder($order); * run Adjusters again eg: Commerce_DiscountAdjuster->adjust(..) Was just about ready to hand over the finished site when I stumbled accross this issue Jun 14, 2017 at 4:58
  • hmm if it is that urgent I'd contact Luke Holder on slack for assistance. I note that when an address is changed on the cart it does a recalc for sure, so in our case the discount is applied then anyway, butit's far from ideal. (You'd probably need to ajax do this hack on the cart page and then load in the updated details...) Jun 14, 2017 at 5:15
  • See above, a fix will be along soon Jun 14, 2017 at 6:56

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.