Developer forum

Forum » PIM » Feeds: Price details

Feeds: Price details

Michael Knudsen
Reply

Is it possible in DW10 to get other details about prices than price, currency and vat using the XML feed provider?

In the case below, would I like to have:
Price: 389,50
Currency: DKK
VAT: 25%
Quantity: 1
Valid from: 15. august 2025
Valid to: 15. august 2026

Br. Michael Knudsen


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

You should be able to get the information from the priceviewmodel:

https://doc.dynamicweb.dev/api/Dynamicweb.Ecommerce.ProductCatalog.PriceViewModel.html

That is the result of the calculated price in the context - for this user, at this time, in this currency etc.

But you cannot get the valid from and to - as that is a condition in this case and not part of the priceviewmodel. To get that information out you would need some coding in the template.

 
Michael Knudsen
Reply

Hello Nicolai,

- I do understand its the result of the calculated price in a context, but since it returns one price, then should it be possible include the valid from + valid to + quantity from that price. That must be a minor change for you to include this ;-)

That would make it so much easier to provide these details in a feed (out-of-the-box) and in many cases could it also be a great helper, when trying to find the exact price that have been returned if also the PriceId as returned.

Br. Michael Knudsen

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply
This post has been marked as an answer

It is a little more complicated than that...

What you are eseentially asking is an option to get the price record that gives you the price - if any. Priceviewmodel is represententing many things that is not a pricerecord from our database. E.g. totals, discounts, prices from ERP etc. so just bolting on information from our price database to the priceviewmodel it self would a little messy.

Also in a feed quantity would always be 1. Since you do not have a cart, you would never see other than the price of 1.

Technical - and requires code: In the feed, you can get the price using PriceManager.GetPrice that returns a priceinfo that contains the information you need.

BR Nicolai

Votes for this answer: 1
 
Michael Knudsen
Reply

Hello Nicolai,

- I have found that there are actually 'Quantity' (and UnitId) on <Prices> using the XML feed provider so can't this be expanded to include 'valid from' and 'valid to'?
And are your statement "feed quantity would always be 1" still valid?

<Price>
<PriceWithoutVat>1127.6</PriceWithoutVat>
<PriceWithVat>1409.5</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
</Price>
<PriceInformative>
<PriceWithoutVat>2255.2</PriceWithoutVat>
<PriceWithVat>2819</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
</PriceInformative>
<PriceBeforeDiscount>
<PriceWithoutVat>2255.2</PriceWithoutVat>
<PriceWithVat>2819</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
</PriceBeforeDiscount>
<Prices>
<Quantity>16</Quantity>
<UnitId/>
<Price>
<PriceWithoutVat>838</PriceWithoutVat>
<PriceWithVat>1047.5</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
</Price>
</Prices>
<Prices>
<Quantity>32</Quantity>
<UnitId/>
<Price>
<PriceWithoutVat>500</PriceWithoutVat>
<PriceWithVat>625</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
</Price>
</Prices>

Br. Michael Knudsen

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

On the calculated price

For the calculated price on a product, quantity is always 1 in a feed. Quantity only varies in a cart context.

On the Prices loop (quantity prices)

This loop is different. It holds the prices that could apply in the cart right now — i.e. the prices that would come into effect if you changed only the quantity or unit (as happens when adding the product to the cart). It's essentially the set of currently-applicable price tiers.

We can add the ValidFrom / ValidTo dates to the view model, but it's worth being clear that they behave differently from the other properties (Quantity and UnitId):

  • Quantity and UnitId describe variations you can still reach — change the quantity or pick a different unit, and that tier's price applies.
  • The dates would not work that way. The loop only ever contains prices whose date range includes today, because the prices are resolved at calculation time (now). A price that was valid in the past, or only becomes valid in the future, can never be triggered by adding the product to the cart today — so it isn't in the list at all.

In other words: adding the date fields lets you display the validity window of the currently-active prices, but it does not let you browse past or future prices. Only prices valid as of today are ever included.

If your goal is to list past or future prices, we need to do something else - because that would be a behavior we cannot change without compatibility issues.

 
Michael Knudsen
Reply

Hello Nicolai, 

- and thanks for the detailed explanation. My goal isn't to list past or future prices, but it's actually to show the valid from / valid to date range for the price.

Should I created it as a feature request on GitHub?

For the calculated price, the XML could look like this:

<Price>
<PriceWithoutVat>1127.6</PriceWithoutVat>
<PriceWithVat>1409.5</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
<ValidFrom>2026-01-01</ValidFrom>
<ValidTo>2026-12-31</ValidTo>
</Price>

For the price loop, the XML could look like this:

<Prices>
<Quantity>16</Quantity>
<UnitId/>
<Price>
<PriceWithoutVat>838</PriceWithoutVat>
<PriceWithVat>1047.5</PriceWithVat>
<CurrencyCode>DKK</CurrencyCode>
<ValidFrom>2026-01-01</ValidFrom>
<ValidTo>2026-12-31</ValidTo>
</Price>
</Prices>

PS.  if I need a price in the past or in the furture, I have to adjust the date in the feed or in the url (&Time).

Br. Michael Knudsen

 

 

You must be logged in to post in the forum