Can someone give me an example on how to get the unit price using the /dwapi/ecommerce/products/{id} endpoint?
Guess I have to use StockUnitSettings? Would be great to get an example on how to use that setting.
Developer forum
E-mail notifications
Get unit price /dwapi/ecommerce/products/{id}
Replies
I do not hink you can actually... It will give you default unit price if the product comes in various units.
The product has a prices property - but that is related to quantities only (currently).
What would be the best way to solve this?
- We can make it so you can send in a unit (on the context like language, country, currency etc), and then all things related to that unit will change - UnitPrice - and quantity prices loop.
- Adding a unitprices property that will return the different prices for the different units - then you can list the different units and their prices. Only caveat is that you cannot see the different quantity prices for each unit, unless the model will be relatively deep.
StockUnitSettings is used to control what is returned on the StockUnits property. I.e. you can add StockUnitSettings.FilledProperties=UnitName,StockLevel to only return those 2 properties and not all the other properties on the StockUnits viewmodel. This is used to limit the response type. If you are really doing weird stuff you can also do StockUnitSettings.LanguageID=lang2 to get different translations of the units than the products...
BR Nicolai
Thank you Nicolai, now I understand a bit more how it works.
If I could choose I would like them both :)
But for a start it would be nice to be able to send in UnitId and Quantity to calculate price on one product based on units.
You must be logged in to post in the forum