somdn_dlcount != total_sales

Posted by: nova-Institut für politische und ökologische Innovation GmbH

26th November 2022, 1:32 pm

Hi,

we are using Free Downloads WooCommerce Pro, very happy with it, everything works fine.

We encountered however something we can't explain: for each free download our system saves not only the 'somdn_dlcount' meta key, but also WooCommerce's 'total_sales' meta key. We use remove_action/add_action 'somdn_count_download' and then:

$x = get_post_meta( $product_id, 'somdn_dlcount', true );
$x++;
update_post_meta( $product_id, 'somdn_dlcount', $x );

$y = get_post_meta( $product_id, 'total_sales', true );
$y++;
update_post_meta( $product_id, 'total_sales', $y );

Imho these two numbers should be equal, but they aren't. Any ideas why?

Thanks alot, best regards
Daniel

Last modified: 29th November 2022, 9:37 am by Peter Wilkinson

  • Forum Moderator
    Peter Wilkinson

    @wpenhanced

    29 Nov 2022
    9:38 am

    Hi Daniel

    Thanks for this (sorry for the delay, missed this)

    What is the end result? I am a little confused what you are trying to do.

  • Hi Peter,

    thanks for your reply. We are trying to count the free downloads of our publications. For testing purposes we wanted to count the downloads in two different custom fields, WooCommerce's 'total_sales' and your plugin's 'somdn_dlcount', assuming that the resulting numbers should be equal, but they aren't.

    Additionally we found that the sum of posts from post_type 'somdn_tracked' are not equal to the 'somdn_dlcount' field either. Shouldn't these two numbers match?

    Thanks
    Daniel