Shipping tax (and other included order level adjustments) are invoiced twice

Created on 11 June 2024, 17 days ago

Problem/Motivation

Commerce adjustments on the order level are added as line items when the gateway is configured to send the basket.

 if ($configuration['send_basket'] == '1') {
      $gateway->setBasket($this->prepareOrderItems($order));
    }

Order level adjustments like shipping promotions and shipping tax may displayed separately or included in the shipping price.

The method prepareOrderItems, adds adjustments as a line item regardless of whether the adjustment is already included in the price, leading to double counting of adjustments that are included in the price.

This results in the amount on the invoice being incorrect. For credit card payment the person pays the correct total, but has an incorrect invoice. For invoice payment I suspect the person will be invoiced twice by Payrexx for order shipping tax. Similarly, shipping promotions will be deducted twice.

This issue was introduced with the implementation of #3302555.

Steps to reproduce

Install the payrexx module.
Configure to send the basket to payrexx.
Configure shipping with tax (or promotions).
Configure the shipping tax plugin to include shipping VAT in the shipping price.
Purchase a physical product with shipping costs.

Proposed resolution

Only add the order level adjustment if it is not included in the price.

Remaining tasks

An MR is to follow shortly.

User interface changes

None.

API changes

None.

Data model changes

None.

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland tcrawford

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024