Skip to content

How to Extract Product Prices in Other Currencies with Product API ​

Certain shopping sites present pricing information in currencies based on the location of the visitor. In these situations Diffbot will usually get the US-directed pricing (dollars), as our rendering engines are located in the US.

If you wish to access pricing information for a different country/region, there are a few approaches to consider:

  • Some sites set a cookie with visitor’s location information, either on first visit or after an explicit country/location selection. If this is the case, you can retrieve the cookie value that your browser sets, and then pass this cookie as a custom header in your Diffbot request. See how to do this.
  • Try setting a custom Accept-Language header specific to the language preference(s) of your desired currencies. See how to send custom headers.
  • Assuming you have access to the localized price information (via machines located in another country), you can download and then POST the HTML directly to the Product API for processing. See how to do this.
  • The Product API also offers the field(s) offerPriceDetails, regularPriceDetails, and saveAmountDetails. Each includes currencyCode, the ISO 4217 code of the price's currency (e.g., "currencyCode": "CAD"), alongside the symbol as written on the page (e.g., "symbol": "$"). Use currencyCode for your own currency conversion logic: unlike the symbol, it tells apart currencies that share one ($ for USD, CAD or AUD; kr for SEK, NOK or DKK). It comes from the page's price markup when present, otherwise from the price text and the page's country and language.