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: variations exported as draft were imported as draft #36933
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #36933 +/- ##
==========================================
- Coverage 46.7% 46.7% -0.0%
- Complexity 17178 17187 +9
==========================================
Files 429 429
Lines 64779 64823 +44
==========================================
+ Hits 30240 30254 +14
- Misses 34539 34569 +30
|
Test Results SummaryCommit SHA: 5da6a63
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
Now ArrayUtil::get_value_or_default($array, $key, $default) will return null, instead of $default, when $array[$key] exists and is null.
@Konamiman: This looks good to me overall, but I wonder if changing how the method works at this point has any implications. I did a quick search through WC's codebase but there are quite a few results and didn't really test much. What are your thoughts? Could this be considered a breaking change (despite of what the intent was for that method when added)? (related to p7bje6-4Ly-p2#comment-7756) |
@jorgeatorres The method was intended to act as with the fix (and documented as such), so I'd say that it should be fixed; if that's a problem for existing code, then that code should be fixed (just replacing method usages with a That said, maybe fixing the method and the usages is a task best suited for its own pull request, instead of in this one (the other code modifications in this pull request don't involve using |
I agree. I'm not against the change, and we're probably the only users (right now) of that function, so changing it should be fine but we should at least audit the code that currently uses it. If you're willing to split the PR, that'd be great. |
Pull request for the change to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you @Konamiman!
All Submissions:
Changes proposed in this Pull Request:
When a product export that involves a variable product in draft status is performed, the "published" row of the generated CSV has a status of "draft" not only for the main variable product but also for the variations, even though the variations themselves are always in "published" state (otherwise they aren't shown when editing the product).
The product import code is supposed to handle variations as a special case, creating them a status of "published" even if they were set as "draft" in the CSV; but due to a bug (a piece of code that assumed that
1 === 1.0
was true) that wasn't happening. This pull request fixes that.Closes #34962.
How to test the changes in this Pull Request:
Other information:
pnpm --filter=<project> changelog add
?FOR PR REVIEWER ONLY: