shopware / shopware

Shopware 6 is an open commerce platform based on Symfony Framework and Vue and supported by a worldwide community and more than 1.500 community extensions
https://shopware.com
MIT License
2.75k stars 1k forks source link

The plugin does not use the price definition correctly #3986

Open shopwareBot opened 1 month ago

shopwareBot commented 1 month ago

Used Shopware Version: 6.5.8.7

Description:

Line items containing custom products add the extra costs incurred by options onto the total price. This makes it difficult for other plugins to correctly calculate prices for line items containing custom products and forces them to add extra logic to remain compatible.

This could be alleviated by adding the extra costs from any options onto the unit price.

To illustrate the problem, consider a plugin handling return orders, now a customer registers a return order for an order in which he bought a custom product twice, however he only wants to return one of them.

This would result in the following calculation for each implementation:

Costs added to total price

Order:

Unit price: 10€

Option price: 5€

Total price: 2x10€ + 2x5€ = 30€

Return order (Plugin uses unit price):

Unit price: 10€

Refund: 1x10€

Costs added to unit price

Order:

Unit price: 15€

Total price: 2x15€ = 30€

Return order (Plugin uses unit price):

Unit price: 15€

Refund: 1x15€

The first calculation is obviously wrong, this would result in the customer being refunded 5€ less than they should be.

Any plugin handling subsets of products in a line item is likely going to use the unit price for its calculations, as it is more intuitive than dividing the total price.

Also, the isCalculated-flag, indicating that taxes have already been calculated for this line item, is not set for custom products. Please set this flag when taxes have already been calculated.

Environment:

Steps to reproduce:

Expected result: The additional costs incurred by options on a custom product are added to the unit price.

Actual result: The additional costs incurred by options on a custom product are added to the total price.

shopware-issue-bot[bot] commented 1 month ago

We found the following existing issues which may help or are related to your topic:

shopwareBot commented 1 month ago

[public] Automated response: This issue is linked to the internal issue https://shopware.atlassian.net/browse/CUS-695.

[created from CUS-695, comment 484909]