Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Fix: shipping row style when Cost of Goods Sold is enabled on the order edit screen#63396

Merged
jorgeatorres merged 14 commits intowoocommerce:trunkfrom
Abdalsalaam:fix/issue-63394
Mar 12, 2026
Merged

Fix: shipping row style when Cost of Goods Sold is enabled on the order edit screen#63396
jorgeatorres merged 14 commits intowoocommerce:trunkfrom
Abdalsalaam:fix/issue-63394

Conversation

@Abdalsalaam
Copy link
Copy Markdown
Contributor

@Abdalsalaam Abdalsalaam commented Feb 20, 2026

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 :
image

After:
Screenshot 2026-02-21 at 1 19 39 AM

Before After
Shipping row has 6 <td>s; top/bottom border appears cut short Shipping row has 7 <td>s; border spans full table width consistently

How to test the changes in this Pull Request:

Using the WooCommerce Testing Instructions Guide, include your detailed testing instructions:

  1. Enable Cost of Goods Sold: WooCommerce → Settings → Advanced → Features → Cost of Goods Sold.
  2. Go to WooCommerce → Orders and open any order that has a shipping method applied.
  3. Confirm the shipping row borders span the full table width and align with product rows.
  4. Inspect the DOM — confirm the shipping row (<tr class="shipping">) now has 7 <td> elements, including <td class="item_cost_of_goods">.
  5. Click Add shipping to add a new shipping row via AJAX. Confirm the dynamically-added row also has 7 <td> elements and renders with consistent borders.
  6. Disable COGS and repeat steps 2–5. Confirm the shipping row (both saved and AJAX-added) has 6 <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-env environment:

  • With COGS enabled: saved and AJAX-added shipping rows include td.item_cost_of_goods; row borders align with the full table width.
  • With COGS disabled: shipping rows omit the COGS column; layout is consistent with product rows and the table header.

Milestone

Changelog entry

  • Automatically create a changelog entry from the details below.
  • This Pull Request does not require a changelog entry. (Comment required below)
Changelog Entry Details

Significance

  • Patch
  • Minor
  • Major

Type

  • Fix - Fixes an existing bug
  • Add - Adds functionality
  • Update - Update existing functionality
  • Dev - Development related task
  • Tweak - A minor adjustment to the codebase
  • Performance - Address performance issues
  • Enhancement - Improvement to existing functionality

Message

Fix misaligned order rows on the edit order screen when Cost of Goods Sold is enabled.

Changelog Entry Comment

Comment

@github-actions github-actions Bot added type: community contribution plugin: woocommerce Issues related to the WooCommerce Core plugin. labels Feb 20, 2026
@Abdalsalaam Abdalsalaam marked this pull request as ready for review February 20, 2026 23:39
@woocommercebot woocommercebot requested review from a team and jorgeatorres and removed request for a team February 20, 2026 23:39
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 20, 2026

Testing Guidelines

Hi ,

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:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 20, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: aedec14f-e02c-4214-9852-96954fc8f5e1

📥 Commits

Reviewing files that changed from the base of the PR and between 7abd502 and f3857fd.

📒 Files selected for processing (1)
  • plugins/woocommerce/changelog/63396-fix-issue-63394

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
Changelog Entry
plugins/woocommerce/changelog/63396-fix-issue-63394
New patch-level changelog entry documenting the fix for misaligned order rows on the edit order screen when COGS is enabled.
Shipping Item UI
plugins/woocommerce/includes/admin/meta-boxes/views/html-order-shipping.php
Adds conditional rendering of a Cost of Goods Sold table cell in the shipping item row, gated by $cogs_is_enabled.
AJAX Handler
plugins/woocommerce/includes/class-wc-ajax.php
Adds a local assignment fetching CostOfGoodsSoldController::feature_is_enabled() into $cogs_is_enabled; variable is introduced but not used within the function.
Static Analysis Baseline
plugins/woocommerce/phpstan-baseline.neon
Adds a PHPStan baseline entry for an undefined variable $cogs_is_enabled in the shipping view file (variable.undefined).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: fixing the shipping row style misalignment when COGS is enabled on the order edit screen.
Description check ✅ Passed The description provides detailed context about the bug, proposed changes, testing instructions, and verification steps directly related to the PR's objective of fixing the shipping row column mismatch.
Linked Issues check ✅ Passed The PR fully implements the requirements from #63394: adds the missing item_cost_of_goods column to shipping rows, ensures consistency with product rows, and applies the fix to both saved and AJAX-added rows.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the shipping row column mismatch issue: changelog entry, view template modification, COGS feature detection, and PHPStan baseline update.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Abdalsalaam Abdalsalaam changed the title add missing COGS column in shipping row Fix: shipping row style when Cost of Goods Sold is enabled on the order edit screen Feb 20, 2026
Copy link
Copy Markdown
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@Abdalsalaam
Copy link
Copy Markdown
Contributor Author

@jorgeatorres Sure! let me check it
thanks

Copy link
Copy Markdown
Member

@jorgeatorres jorgeatorres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @Abdalsalaam!

✅ Confirmed the table looks correct now even with shipping lines or refunds.

Image

@jorgeatorres jorgeatorres merged commit edc2e57 into woocommerce:trunk Mar 12, 2026
45 of 46 checks passed
@github-actions github-actions Bot added this to the 10.7.0 milestone Mar 12, 2026
@github-actions github-actions Bot added the needs: documentation The issue/PR requires documentation to be added. label Mar 12, 2026
@Abdalsalaam Abdalsalaam deleted the fix/issue-63394 branch April 27, 2026 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs: documentation The issue/PR requires documentation to be added. plugin: woocommerce Issues related to the WooCommerce Core plugin. type: community contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] When COGS is on, shipping row in order items table is missing a column

3 participants