Skip to content

Validated WC cart object to prevent fatal error - #4558

Merged
selul merged 2 commits into
developmentfrom
bugfix/4555
Aug 4, 2026
Merged

Validated WC cart object to prevent fatal error#4558
selul merged 2 commits into
developmentfrom
bugfix/4555

Conversation

@girishpanchal30

Copy link
Copy Markdown
Contributor

Summary

Added a validation for the WooCommerce cart object before rendering the cart icon in the Header Footer Grid, preventing fatal errors when the cart object is unavailable.

Check before Pull Request is ready:

Closes #4555

@pirate-bot pirate-bot added the pr-checklist-complete The Pull Request checklist is complete. (automatic label) label Aug 3, 2026
@pirate-bot

pirate-bot commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Plugin build for 52a9b64 is ready 🛎️!

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Prevents WooCommerce cart rendering from fatally dereferencing a missing cart object.

Changes:

  • Adds cart-object guards to legacy and Header Footer Grid renderers.
  • Adds PHPUnit coverage and minimal WooCommerce stubs.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
inc/views/header.php Guards legacy navigation cart rendering.
header-footer-grid/Core/Components/CartIcon.php Guards builder cart rendering.
tests/test-neve-cart-guards.php Tests unavailable and initialized cart states.
tests/stubs/woocommerce-cart.php Provides isolated WooCommerce test doubles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@selul selul left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Guard is right, but an identical sink is left open elsewhere.

Comment thread header-footer-grid/Core/Components/CartIcon.php
Comment thread tests/stubs/woocommerce-cart.php Outdated
@selul
selul merged commit 146ae00 into development Aug 4, 2026
15 checks passed
@selul
selul deleted the bugfix/4555 branch August 4, 2026 07:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-checklist-complete The Pull Request checklist is complete. (automatic label)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants