awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
867 stars 471 forks source link

Recount earnings and sales not recalculating totals on duplicated downloads #7113

Open arraypress opened 5 years ago

arraypress commented 5 years ago

Bug Report

Expected behavior

This is somewhat of a complex issue, since it took a lot of testing to figure out what was going on here. A customer reported an issue where she was "cloning" (duplicating) downloads using the following free extension:

https://wordpress.org/plugins/duplicate-page/

Because this is not our official Duplicate Downloads extension, the earnings and sales meta data is not being reset on each copy.

Using the "Recount Earnings and Sales for a download" option under Tools on that specific "cloned" download would successfully recalculate the sales and earnings, fixing the issue, but this isn't an ideal solution for larger stores with a lot of products.

However when using the "Recount Earnings and Sales for All downloads" option, the totals are not updated and left as-is.

Actual behavior

"Recount Earnings and Sales for All downloads" does not properly recalculate the sales/earnings on downloads, but functions fine when using the per-download option within totals.

Steps to reproduce the behavior

1) Install the "Duplicate Page" plugin. 2) Duplicate a download that already has sales/earnings data associated with it. 3) Make a purchase of the duplicated download to increase the sales count. 4) Goto Tools and use the "Recount Earnings and Sales for All downloads" option to recalculate the totals for all the downloads. 5) The cloned/duplicated downloads won't be updated and remain in the same state as when cloned. 6) If you use the "Recount Earnings and Sales for a download" option on the duplicated download, it will recalculate the totals fine.

Information (if a specific version is affected):

PHP Version: 7.2

EDD Version (or branch): Latest (2.9.11)

WordPress Version: 5.0.2

cklosowski commented 5 years ago

The first thing we should check here is any differences in the 'duplicated download' from this 3rd party plugin before we try the recount, so we can verify there isn't a bug in their way of duplicating.