-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Clean up and reduce confusion around the woocommerce_order_actions filter
#30475
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
Conversation
To clean up the `woocommerce_order_actions` filter.
| ) | ||
| ); | ||
| $theorder = $theorder instanceof WC_Order ? $theorder : null; | ||
| $order_actions = self::get_available_order_actions_for_order( $theorder ); |
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.
Hi @danielbitzer - Thanks for the PR! So we're trying not to add any new methods unless it is absolutely necessary. And for those cases, we also utilize the internal src namespace to do so. That way it is not publicly exposed. But in this case, I don't think we need a new method for this. Perhaps just put the docblock above the filter for clarity.
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.
HI @roykho! Would making the method private also be acceptable? That way it's not publicly exposed?
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.
Yes that would be better.
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.
Ok great, I've made that change.
See PR #30475 for more info.
|
@danielbitzer - thanks for the update. Can you please add the |
@roykho done! |
roykho
left a comment
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.
Thanks for the changes. LGTM!
|
Hi @roykho, thanks for merging this pull request. Please take a look at these follow-up tasks you may need to perform:
|
All Submissions:
Changes proposed in this Pull Request:
The
woocommerce_order_actionsis used by a a bunch of plugins like WC Payments, Subscriptions, AutomateWoo and could be improved. Currently a global order object ($theorder) is commonly used to conditionally add items to the array depending on what type of order is being edited. Rather than use a global this should be a filter argument.This PR adds an
$orderfilter argument to thewoocommerce_order_actionsfilter while maintaining backwards compatibility.How to test the changes in this Pull Request:
Other information:
Changelog entry
FOR PR REVIEWER ONLY: