• Resolved Jamesking56

    (@jamesking56)


    Hello,

    We have a shop with variable products where the price changes depending on what attributes are set to.

    I’m pulling in the products in a separate system using the Woocommerce API v3 (and the official php library).

    The issue I have is, since these products have a variable price, how do I pull down the price of the product when certain attributes are selected?

    This doesn’t seem to be clear at all in the API documentation.

    Cheers.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Luminus Alabi

    (@luminus)

    Automattic Happiness Engineer

    Hi @jamesking56,

    You can’t use the REST API to calculate new prices. You need to handle that calculation locally some other way.

    The REST API will allow you to either retrieve product information or update it. Any calculation will need to be handled after the fact outside of the functionality of the API.

    Thread Starter Jamesking56

    (@jamesking56)

    Hi Luminus,

    Thanks for the speedy reply, what is the best way for my app to calculate the price based on attribute selections?

    Cheers.

    Plugin Support Riaan K.

    (@riaanknoetze)

    That would be handled in the code of the app though and varies for each use-case – there’s no off-the-shelf library of calculations. Moreover, the exact code would also be different for each programming language.

    To review any code of you’ve already written, we’d recommend getting in touch with the web developer community at large though (e.g. StackOverflow).

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Calculate new price for variable product using API’ is closed to new replies.