-
Notifications
You must be signed in to change notification settings - Fork 215
fix: conditionally hide commission metabox for advertisement product orders #2786
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
base: develop
Are you sure you want to change the base?
fix: conditionally hide commission metabox for advertisement product orders #2786
Conversation
WalkthroughA new filter hook, Changes
Sequence Diagram(s)sequenceDiagram
participant Admin as WooCommerce Admin Order Page
participant Hooks as Dokan Hooks
participant Filter as External Filter (via dokan_show_commission_meta_box)
Admin->>Hooks: Load order details page
Hooks->>Filter: Apply dokan_show_commission_meta_box filter (default: !has_sub_order, pass $order)
Filter-->>Hooks: Return true/false
alt Filter returns true
Hooks->>Admin: Show commission meta box
else Filter returns false
Hooks->>Admin: Do not show commission meta box
end
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
includes/Order/Admin/Hooks.php (1)
566-570
: Well-implemented filter hook for commission metabox visibility control.The filter implementation is clean and follows WordPress conventions. It maintains backward compatibility while allowing external control over the commission metabox visibility. The order object parameter provides good context for filtering decisions.
Consider adding inline documentation to describe the filter's purpose and parameters for better developer experience:
+ /** + * Filters whether to show the commission meta box on order details page. + * + * @since 3.14.0 + * + * @param bool $show_commission_meta_box Whether to show the commission meta box. Default is true when order has no sub-orders. + * @param WC_Order $order The order object. + */ $show_commission_meta_box = apply_filters( 'dokan_show_commission_meta_box', ! $has_sub_order, $order );
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
includes/Order/Admin/Hooks.php
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: api tests (1, 1)
- GitHub Check: e2e tests (2, 3)
- GitHub Check: e2e tests (1, 3)
- GitHub Check: e2e tests (3, 3)
🔇 Additional comments (1)
includes/Order/Admin/Hooks.php (1)
573-573
: Conditional check updated correctly to use filtered value.The condition properly uses the filtered value to determine whether to add the commission metabox, maintaining the intended functionality while allowing external control.
All Submissions:
Related Pull Request(s)
Closes
How to test the changes in this Pull Request:
Changelog entry
Summary by CodeRabbit