In Shopware one can have multiple order transactions for an order. An order_transaction
contains an amount which looks as follows;
{
"quantity": 1,
"taxRules": [
{
"taxRate": 22.0,
"extensions": [
],
"percentage": 100.0
}
],
"listPrice": null,
"unitPrice": 12.0,
"totalPrice": 12.0,
"referencePrice": null,
"calculatedTaxes": [
{
"tax": 2.16,
"price": 12.0,
"taxRate": 22.0,
"extensions": [
]
}
],
"regulationPrice": null
}
What is the difference between the unitPrice
and totalPrice
?
What's the use of the quantity
field?
There's documentation about Payments in Shopware but doesn't say any details about the amount field.
To put it short:
unitPrice = totalPrice / quantity
In the context of transactions the quantity
field isn't really used though. A line item of a cart may have a quantity greater than 1 though and that's where the prices of the unit and the total price of the position may differ. Still, for reasons of conformity, all price fields use a common object structure, which will include all of these fields, even if they may not be fully utilized.