Developer forum

Forum » Development » Get unit price /dwapi/ecommerce/products/{id}

Get unit price /dwapi/ecommerce/products/{id}

Martin Moen
Reply

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.


Replies

 
Nicolai Pedersen
Reply
This post has been marked as an answer

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?

  1. 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.
  2. 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

Votes for this answer: 1
 
Martin Moen
Reply

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