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
, andsaveAmountDetails
, each of which will include the symbol field—e.g., "symbol": "$". You can use this symbol as a means to script your own currency conversion logic.
Updated over 2 years ago