• Resolved pujithamutyala

    (@pujithamutyala)


    Hi Team,
    
    There is a difference in prices in WooCommerce StoreAPI for cart endpoints and WC REST API for products. For example :
    
    WC Get Product Endpoint:
    
    https://stokkur.wpcomstaging.com/wp-json/wc/v3/products/420
    
    Price in response :
    
    “price”: “1890”,
    
    “regular_price”: “1890”,
    
    WooCommerce Store API Get Cart Endpoint when product 420 is added :
    
    https://stokkur.wpcomstaging.com/wp-json/wc/store/v1/cart
    
    Price in response:
    
    “prices”: {
    
    “price”: “189000”,
    
    “regular_price”: “189000”,
    
    “sale_price”: “189000”,
    
    “currency_code”: “ISK”,
    
    “currency_symbol”: “kr.”,
    
    “currency_minor_unit”: 2,
    
    Due to this there is a confusion in the price data in endpoints. Can you please let us know why is it like this?
Viewing 1 replies (of 1 total)
  • Plugin Support Shameem R. a11n

    (@shameemreza)

    Hi @pujithamutyala

    The discrepancy you’re seeing in the prices between the WC REST API for products and the WooCommerce Store API for cart endpoints is due to the currency_minor_unit field in the Store API response.

    The currency_minor_unit field indicates the number of decimal places for the currency, in this case, ISK. The value 2 means that the actual price is the given value divided by 100.

    So, when you see a price of 189000 with a currency_minor_unit of 2, the actual price is 1890.00. This is consistent with the price you’re seeing from the WC Get Product Endpoint.

    The Store API shows prices in minor units to be more precise and to avoid rounding errors that could occur in some currencies.

    I hope this clears up the confusion. Please don’t hesitate to ask if you have any more questions!

Viewing 1 replies (of 1 total)
  • The topic ‘Difference in Prices in WooCommerce Store API and WC REST API’ is closed to new replies.