Skip to content

Apply item-level discount before tax calculation - #289

Open
Marvin-Magmodules wants to merge 1 commit into
masterfrom
improvement/item-level-discount-tax
Open

Apply item-level discount before tax calculation#289
Marvin-Magmodules wants to merge 1 commit into
masterfrom
improvement/item-level-discount-tax

Conversation

@Marvin-Magmodules

@Marvin-Magmodules Marvin-Magmodules commented Aug 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Channable sends per-product discount fields but these were ignored
  • Discounts were only applied at order level after tax was already calculated, causing tax to be computed on the undiscounted price
  • Now subtracts item discount from OriginalCustomPrice so Magento calculates tax on the correct (discounted) amount
  • Falls back to order-level discount when no item discounts are present (backward compatible)

Changes

  • Service/Order/Items/Add.php — subtract item['discount'] from price before setting OriginalCustomPrice
  • Service/Order/Import.php — skip order-level discount when item-level discounts exist (prevents double discount)

Channable sends per-product discount fields but these were ignored.
Discounts were only applied at order level after tax was already
calculated, causing tax to be computed on the undiscounted price.

Now subtracts item discount from OriginalCustomPrice so Magento
calculates tax on the correct (discounted) amount. Falls back to
order-level discount when no item discounts are present.

Adds E2E tests for item-level discount tax calculation.

Ref: channable/magento-plugin#28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant