Skip to content

Discount fixed amount whole cart applied mutiple time when customer use Check Out with Multiple Addresses #25834

Closed
@hoangnm89

Description

@hoangnm89

Preconditions (*)

  1. Fresh Magento 2.3.3

Steps to reproduce (*)

  1. Create cart rule, no condition, action: Fixed amount discount for whole cart. Discount amount $10
  2. Create account, create 2 addresses: address 1, address 2
  3. Add 2 SKUs to cart: SKU1, SKU2
  4. Check Out with Multiple Addresses
  5. SKU1 ship to address 1, SKU2 ship to address 2
  6. Place order
  7. Magento auto split order into 2 orders.

Expected result (*)

  1. First Order get discount $10.
  2. Second Order should not get discount.

Actual result (*)

  1. Both order get $10 discount, Total discount is $20

=============
According magento comment in code:
https://github.com/magento/magento2/blob/2.3-develop/app/code/Magento/SalesRule/Model/Rule/Action/Discount/CartFixed.php#L77

/**
 * prevent applying whole cart discount for every shipping order, but only for first order
 */
if ($quote->getIsMultiShipping()) {
    $usedForAddressId = $this->getCartFixedRuleUsedForAddress($rule->getId());
    if ($usedForAddressId && $usedForAddressId != $address->getId()) {
        return $discountData;
    } else {
        $this->setCartFixedRuleUsedForAddress($rule->getId(), $address->getId());
    }
}

=== UPDATE: Dec 04 ===
Please cover this case as well
SKU 1: 100$
SKU 2: 200$
Rule: Fix amount 150$ for whole cart(CartFixed)
i add to cart:
SKU 1 - qty 1
SKU 2 - qty 1
then checkout:
SKU 1 - address 1
SKU 2 - address 2

Expectation:

after checkout:
Sale Order 1: discount amount 100$
Sale Order 2: discount amount: 50$

Metadata

Metadata

Labels

Component: MultishippingFixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions