• Resolved machine1

    (@machine1)


    Hi there,

    I am trying to get the total_sales to display on the product page.
    For simple products, I am able to achieve this, but for products with variations, the total_sales is always “0”.

    I am unsure if this is a problem with how I am getting the variation data or this is a bug.

    The below is how I am retrieving the variation data:

    $variation_obj = new WC_Product_variation($variation_id); //store variations in a new object
    $units_sold_variation = $variation_obj->get_total_sales(); //get units sold for variation

    Can you please assist?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Sérgio L. a11n

    (@csnlima)

    Hi Roshan,

    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.

    If not, I’d also suggest visiting the WooCommerce Facebook Community group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Best,

    We haven’t heard back from you in a while, (I think that at this point you have been able to find a solution) so I’m going to mark this as resolved – we’ll be here if and/or when you are ready to continue.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘total_sales for product_variation always “0”’ is closed to new replies.