Fix: shipping row style when Cost of Goods Sold is enabled on the order edit screen#63396
Conversation
Testing GuidelinesHi , Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed. Reminder: PR reviewers are required to document testing performed. This includes:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a conditional Cost of Goods Sold (COGS) column to the shipping item row markup, introduces a COGS feature-flag read in an AJAX handler, adds a PHPStan baseline entry for an undefined-variable report, and includes a changelog entry documenting the patch fix. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@plugins/woocommerce/includes/admin/meta-boxes/views/html-order-shipping.php`:
- Around line 60-62: The template renders an empty shipping COGS table cell only
when $cogs_is_enabled is truthy, but callers might omit that variable; add a
defensive fallback at the top of this template to ensure $cogs_is_enabled is
defined (set to false by default) so no PHP notices or broken layout
occur—locate the template that contains the conditional and add a short guard
that checks isset($cogs_is_enabled) and assigns false if missing before the code
that references $cogs_is_enabled.
jorgeatorres
left a comment
There was a problem hiding this comment.
Hey @Abdalsalaam!
Thanks for your contribution and apologies for the delay in reviewing. The fix is correct, but it'd be good to address this for fees (html-order-fee.php) and refunds as well (html-order-refund.php).
Is this something you'd be able to work on?
Thanks again!
|
@jorgeatorres Sure! let me check it |
jorgeatorres
left a comment
There was a problem hiding this comment.
LGTM. Thanks @Abdalsalaam!
✅ Confirmed the table looks correct now even with shipping lines or refunds.
Submission Review Guidelines:
Changes proposed in this Pull Request:
When the Cost of Goods Sold feature is enabled, the shipping row (
<tr class="shipping">) in the order edit screen had only 6<td>elements while product line item rows had 7. The missing column was<td class="item_cost_of_goods">, which caused the shipping row to be narrower than the table, resulting in broken/incomplete top and bottom borders.Closes #63394.
Screenshots or screen recordings:
Before :

After:

<td>s; top/bottom border appears cut short<td>s; border spans full table width consistentlyHow to test the changes in this Pull Request:
Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:
<tr class="shipping">) now has 7<td>elements, including<td class="item_cost_of_goods">.<td>elements and renders with consistent borders.<td>elements and no COGS column, consistent with the table header and product rows.Testing that has already taken place:
Manually verified in a local
wp-envenvironment:td.item_cost_of_goods; row borders align with the full table width.Milestone
Changelog entry
Changelog Entry Details
Significance
Type
Message
Fix misaligned order rows on the edit order screen when Cost of Goods Sold is enabled.
Changelog Entry Comment
Comment