Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.8.1]: Action update cart doesn't update shipping/tax #3888

Closed
smcyr opened this issue Feb 7, 2025 · 6 comments
Closed

[4.8.1]: Action update cart doesn't update shipping/tax #3888

smcyr opened this issue Feb 7, 2025 · 6 comments
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce

Comments

@smcyr
Copy link

smcyr commented Feb 7, 2025

What happened?

After upgrading from 4.7.2 to 4.8.1, the cart doesn't update the tax/shipping after the first time. From what I can see in the CartController, the recalculationMode is set to none before the order is saved, so the second time you update the cart, it doesn't recalculate.

CartController.php:

$this->_cart->recalculate();
$this->_cart->recalculationMode = Order::RECALCULATION_MODE_NONE;
...
if (!$this->_cart->validate($attributes, false) || !Craft::$app->getElements()->saveElement($this->_cart, false, false, $updateCartSearchIndexes)) {

From what I can see in the code, the problem is probably also present in Craft Commerce 5.3.2 because of the commit Move recalculation inside of cart controller

Craft CMS version

4.14.4

Craft Commerce version

4.8.1

@smcyr smcyr added bug commerce4 Issues related to Commerce v4 Craft Commerce labels Feb 7, 2025
Copy link

linear bot commented Feb 7, 2025

@RitterKnightCreative
Copy link

Excellent spot. Spent the last hour or so trying to track this down myself based on when we updated the site. Client e-mailed wondering why a couple of orders weren't including shipping charges.

@smcyr
Copy link
Author

smcyr commented Feb 7, 2025

Excellent spot. Spent the last hour or so trying to track this down myself based on when we updated the site. Client e-mailed wondering why a couple of orders weren't including shipping charges.

Same happened to us, our client contacted us with an order that didn't include the right tax and shipping in production. Downgrading didn't fix the issue immediatly, I also needed to update the column relcalculate in the table commerce_orders manually.

@RitterKnightCreative
Copy link

I was able to revert the CartController.php back to what it was before and that seems to have solved it as a temporary workaround. I'm honestly surprised this got past Pixel and Tonic's usually decent QA.

@lukeholder
Copy link
Member

Apologies, we have release 4.8.1.1 and 5.3.2.1 which fixes this regression.

We will look into a better solution after the weekend.

@lukeholder
Copy link
Member

We just released 5.3.2.2 and 4.8.1.2

This patch ensures that any affected carts have the correct recalculation mode set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4 Craft Commerce
Projects
None yet
Development

No branches or pull requests

3 participants