Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

total_sales meta key alway incrementing #10725

Closed
jawad-ahmed opened this issue Apr 18, 2016 · 8 comments
Closed

total_sales meta key alway incrementing #10725

jawad-ahmed opened this issue Apr 18, 2016 · 8 comments

Comments

@jawad-ahmed
Copy link

Hello,

Wordpress v4.4.2 / WooCommerce v2.5.5/ StoreFront theme

I think I have found a bug. I have confirmed this with another plugin developer who has been able to replicate this issue. The meta key 'total_sales' increments when an order is placed. Subsequently, when a order status is changed to 'Refunded', 'Cancelled' or Trashed, it should deduct the 'total_sales', but this does not happen.

Instead, it remains on the same number and continues to be incremented for every new sale. This essentially defeats the purpose of the 'total_sales' meta key as the data would be largely incorrect if 'total_sales' does not get negated when an order is refunded/cancelled/trashed.

Please confirm if you can replicate? All you need to do is refund/cancel/trash an order and see if 'total_sales' gets deducted or not.

Many Thanks,
Jawad

@claudiosanches
Copy link
Contributor

Not a bug, see #5928

@jawad-ahmed
Copy link
Author

Hi claudiosmweb,

I fail to see how it's working as intended though? It is called 'total_sales' which implicates the total number of times the product has sold - if it's not doing that then it would make sense to call it otherwise.

I am using a marketplace plugin which uses 'total_sales' to report how many times a product has sold. But this data is incorrect because it doesn't take into account refunded/cancelled/trashed orders.

All the thread you posted to says is that it is a lot of effort for not so much gain, but it does not stop it from being a bug.

Many Thanks,
Jawad

@claudiosanches
Copy link
Contributor

You can create a new field to track it if you really need.

@jawad-ahmed
Copy link
Author

Hi again,

Thanks for your response. I am not using it to track it. The marketplace plugin 'WC Vendors' uses this field to display the total sales of a product. Very misleading now considering it doesn't take into account order statuses. Very odd how this isn't considered a bug though?

Many thanks,
Jawad

@claudiosanches
Copy link
Contributor

Just read this #5928

@jawad-ahmed
Copy link
Author

jawad-ahmed commented Apr 19, 2016

Hi Claudio,

I have read it. The thread mentions it is too much effort for little gain. However, this is only relevant when used for best selling widget.

The problem arises when a plugin starts utilising the field to report total product sales which is the case for the marketplace plugin I am using. I will speak with them to determine if there is any benefit to using the total_sales field as it is completely inaccurate.

Many Thanks,
Jawad

@claudiosanches
Copy link
Contributor

The problem arises when a plugin starts utilising the field to report total product sales which is the case for the marketplace plugin I am using.

Still not needed on WooCommerce core. As I said, if you need, you can create a plugin for it.

@ssaltman
Copy link

Just fyi, I wrote a function to deal with this.

https://stackoverflow.com/a/59538372/612127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants