Support » Plugin: WooCommerce » WooCommerce Grouped product API – not get the “sale_price”

  • Resolved carriechan

    (@carriechan)


    Hello Team,

    WooCommerce Grouped product API – getting the wrong “regular_price” not the “sale_price” (if the products are on sale)

    Please take a look the following screenshot (Pink colour highlighted)
    https://ibb.co/HKSGkbc

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Abiola

    (@oaoyadeyi)

    @carriechan

    This is a fairly complex development topic. I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.
    
    I can also recommend <a href="https://developer.woocommerce.com/" rel="noopener" target="_blank">the WooCommerce Developer Resources Portal</a> for resources on developing for WooCommerce.
    
    You can also visit the <a href="https://www.facebook.com/groups/advanced.woocommerce/" rel="noopener" target="_blank">WooCommerce Facebook group</a> or the <code>#developers</code> channel of the <a href="https://woocommerce.com/community-slack/" rel="noopener" target="_blank">WooCommerce Community Slack</a>. We're lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.
    Thread Starter carriechan

    (@carriechan)

    Thank you Oyadeyi 🙂

    Plugin Support 3 Sons Development – a11n

    (@3sonsdevelopment)

    Hey @carriechan,

    I did a bit of testing with this. Say we have a grouped product with three products in it. The “price” that’s saved for the grouped product will be the lowest price of the products in the group. It’ll be saved as a custom field with _price as the key.

    If I edit one product and add a sale price, the grouped price will not change. Viewing the grouped product on the front-end of the site will show the correct prices but the custom field won’t be updated. As a result, the REST API won’t show the updated price either.

    You can remove the product with the sale price from the group, then update the product. After that, add the product back again. That will show the correct price in the REST API.

    It turns out there is an open issue about this on GitHub. I added a comment about your findings to it. Feel free to follow along with developments there.

    https://github.com/woocommerce/woocommerce/issues/25808

    Thread Starter carriechan

    (@carriechan)

    Hello @3sonsdevelopment,

    This is the BUG and I gave up the Grouped product API to get the “sale_price”, instead, I have used the “price_html” and get the sale_price / regular_price correctly.

    • This reply was modified 11 months, 3 weeks ago by carriechan.
    Plugin Support Margaret S. woo-hc

    (@margaretwporg)

    Hi @carriechan

    Thanks for sharing the workaround.

    It’ll be helpful for the community in the meantime.

    Hope the issue moves towards a resolution soon on GitHub.

    I’ll mark this thread closed here as further updates can be seen on GitHub.

    If you have other questions, please feel free to open a new topic.

    Cheers

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WooCommerce Grouped product API – not get the “sale_price”’ is closed to new replies.