nopCommerce icon indicating copy to clipboard operation
nopCommerce copied to clipboard

Reorder uses prices exluding tax for customer entered prices regardless of taxsettings

Open AndreiMaz opened this issue 3 years ago • 3 comments

nopCommerce version: 4.40.3

Steps to reproduce the problem:

have a problem with my shopping cart total decreasing every time i do reorder on an order including products with CustomEredenteredPrice options enabled. It only happens when PricesIncludeTax is enabled in taxsettings.

Found out that the ReOrderAsync function in the OrderProcessingService is always using orderItem.UnitPriceExclTax regardless of taxsettings.

Original code:

await _shoppingCartService.AddToCartAsync(customer, product,
                    ShoppingCartType.ShoppingCart, order.StoreId,
                    orderItem.AttributesXml, orderItem.UnitPriceExclTax,
                    orderItem.RentalStartDateUtc, orderItem.RentalEndDateUtc,
                    orderItem.Quantity, false);

Fix:

await _shoppingCartService.AddToCartAsync(customer, product,
                    ShoppingCartType.ShoppingCart, order.StoreId,
                    orderItem.AttributesXml, _taxSettings.PricesIncludeTax ?
                    orderItem.UnitPriceInclTax : orderItem.UnitPriceExclTax,
                    orderItem.RentalStartDateUtc, orderItem.RentalEndDateUtc,
                    orderItem.Quantity, false);

This way the customered entered price will be correct both for those who have the PricesIncludeTax option enabled or disabled :)

Source: https://www.nopcommerce.com/en/boards/topic/91910/reorder-uses-prices-exluding-tax-for-customer-entered-prices-regardless-of-taxsettings

AndreiMaz avatar Sep 17 '21 04:09 AndreiMaz

If this issue needs to be resolved, I will be happy to do it.

or if you could recommend another issue. So I could contribute something

@AndreiMaz @RomanovM

shadev256 avatar Oct 24 '22 08:10 shadev256

@UsamaShahid69 Sure. Please make a pull request

AndreiMaz avatar Oct 24 '22 08:10 AndreiMaz

I have made the PR for this. You can review it.

PR link: https://github.com/nopSolutions/nopCommerce/pull/6398

@AndreiMaz @RomanovM

shadev256 avatar Oct 28 '22 09:10 shadev256