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

Fix product reports for simple products converted to variable. #2814

Merged
merged 3 commits into from Aug 20, 2019

Conversation

@jeffstieler
Copy link
Contributor

commented Aug 19, 2019

Fixes #2719.

This PR seeks to fix Product Report data when a Simple product (that has sales) has been converted into a Variable product.

We were previously excluding products from the query where variation_id = 0. Since the orders placed for the original Simple product have 0 for the variation_id, they were being excluded from the single product report.

This PR:

  • Adds the simple product orders to the report dataset by removing the WHERE clause that omits the 0 value variation_ids
  • Adds the simple product to the report chart and table by including a new segment label for the 0 variation using the original product name

This PR does not:

Handle comparisons including the original simple product. It will simply be omitted from results if selected since the variation ID is 0.

Screenshots

Before

FireShot Capture 022 - Products ‹ Analytics ‹ WooC_ - http___local wordpress test_wp-admin_admin php

After

FireShot Capture 021 - Products ‹ Analytics ‹ WooC_ - http___local wordpress test_wp-admin_admin php

Detailed test instructions:

  • Follow the steps to reproduce in the issue: #2719
  • Verify that selecting the single product in the Products Report shows sales for both the original product and the variation

Changelog Note:

Enhancement: handle simple to variable product changes in reports.

jeffstieler added 3 commits Aug 17, 2019
Include "variation = 0" orders in variation report data.
This catches simple products with sales that have been converted to variable.

@jeffstieler jeffstieler requested a review from woocommerce/wc-admin Aug 19, 2019

@jeffstieler jeffstieler added this to In Progress PRs (for automation purposes) in wc-admin via automation Aug 19, 2019

@psealock
Copy link
Collaborator

left a comment

This is testing well for me. I can see the historic orders before the product was changed.

This PR does not:
Handle comparisons including the original simple product.

I think thats fine.

Code LGTM and testing well.

@jeffstieler jeffstieler merged commit 7f88d5a into master Aug 20, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

wc-admin automation moved this from In Progress PRs (for automation purposes) to Done Sprint 23 (August 13 - August 26) Aug 20, 2019

@jeffstieler jeffstieler deleted the fix/2719-reports-simple-to-variable-products branch Aug 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.