Incorrect price calculation when ordering through the REST API
-
Hello,
We really like this extension, however, there is one crucial point where we need support to be able to use the extension. By default, we have our prices in USD. We work with fix prices for the different currencies, so no conversion rate should be applied.
If I send an order through the WooCommerce REST API endpoint in a different currency, the the currency is recognized, but the USD prices are applied.
Let’s see an example. We have a product (id=150) with a default USD price $100 and another price in HUF: 30,000 HUF. There is an example below of what I send to the REST API. Note the
currency
field with HUF value. The result has"currency_symbol":"Ft"
so the WooCommerce recognizes the currency, however still uses the 100 value.We experienced the same thing with Fixed prices settings turned on or off, even if the exchange rate is set to 300 (so that $100 -> 30,000 HUF should be applied — but it wasn’t). The result was always 100 HUF which is clearly wrong.
Do we miss something? Does this plugin support the REST API?
https://woocommerce.github.io/woocommerce-rest-api-docs/#create-an-orderWe sent the following request (billing and shipping fields are omitted).
{ "payment_method": "bacs", "payment_method_title": "Direct Bank Transfer", "set_paid": true, "currency": "HUF", "line_items": [{ "product_id": 150, "quantity": 2 }], "shipping_lines": [{ "method_id": "flat_rate", "method_title": "Flat Rate", "total": "10" }] }
Here is the response. Many of the fields are omitted. It is clearly in HUF with the price values of the USD.
{ "id":173, "number":"173", "created_via":"rest-api", "version":"3.8.1", "currency":"HUF", "shipping_total":"10", "total":"210", "line_items": [{ "product_id":150, "quantity":2, "subtotal":"200", "price":100 }], "currency_symbol":"Ft" }
- The topic ‘Incorrect price calculation when ordering through the REST API’ is closed to new replies.