• I use this snipet to display Number Of Products Sold:

    <?php
    add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
    function wc_product_sold_count() {
    global $product;
    $units_sold = get_post_meta( $product->id, 'total_sales', true );
    echo '<p>' . sprintf( __( 'Units Sold: %s', 'woocommerce' ), $units_sold ) . '</p>';
    }
    ?>

    But when the order being canceled, it doesn’t change anything. It should show the number before the order was placed. Ex:

    Before placing order: 10
    after placing order : 15
    Cancel order : 15 (it’s still there) but I want it’s 10

    Anyone can help me?

    https://wordpress.org/plugins/woocommerce/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Number Of Products Sold’ is closed to new replies.