-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed carts stuck with incorrect recalculation mode
- Loading branch information
1 parent
236f9f7
commit 46e3381
Showing
3 changed files
with
38 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/migrations/m250210_125139_fix_cart_recalculation_modes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace craft\commerce\migrations; | ||
|
||
use craft\commerce\db\Table; | ||
use craft\commerce\elements\Order; | ||
use craft\db\Migration; | ||
|
||
/** | ||
* m250210_125139_fix_cart_recalculation_modes migration. | ||
*/ | ||
class m250210_125139_fix_cart_recalculation_modes extends Migration | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeUp(): bool | ||
{ | ||
$this->update(Table::ORDERS, ['recalculationMode' => Order::RECALCULATION_MODE_ALL], [ | ||
'recalculationMode' => Order::RECALCULATION_MODE_NONE, | ||
'isCompleted' => false, | ||
], [], false); | ||
|
||
return true; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function safeDown(): bool | ||
{ | ||
echo "m250210_125139_fix_cart_recalculation_modes cannot be reverted.\n"; | ||
return false; | ||
} | ||
} |