Hi DW,
When adding a product with a product discount through the dwapi endpoint, /dwapi/ecommerce/carts/{secret}/items/, the orderline TotalDiscount is not set on the initial POST request, and requires another request that manipulates the cart, either another product added or a patch request.
Reproduce step:
/dwapi/ecommerce/carts?CurrencyCode=DKK&CountryCode=DK&LanguageId=LANG1&ShopId=SHOP1
/dwapi/ecommerce/carts/{secret]/items/ with body (this product has aproduct discount)
{
Here is the orderlines added for the first request:
We then need to add another product or patch, here we just do a /dwapi/ecommerce/carts/{secret} with body
and now the orderlines returned is, where the productorderline has the correct TotalDiscount:
The discount is setup as a Product discount with a 20.01 %, the rest of the settings are default when creating a new discount.
The discount is not setup on the shop, but just under Product discount
We're on a DW 9.13.3 and Dynamicweb.Ecommerce 1.3.27 if it helps
EDIT: just as a note aswell, the Price, UnitPrice and UnitPriceBeforeDiscount is returned without any information about the 20% discount aswell. But getting the TotalDiscount on the inital POST would make it possible to make the calculation of prices yourself, if it's a bigger change to solve that aswell :)
Best regards,
Mikkel