Skip to content
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

Fix fatal error when editing the shortcode checkout page #3758

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

wjrosa
Copy link
Contributor

@wjrosa wjrosa commented Jan 22, 2025

Fixes #3757

Changes proposed in this Pull Request:

This PR fixes a fatal error thrown when editing the shortcode checkout page on PHP 8.4 with an empty cart:

PHP Fatal error: Uncaught Error: Call to a member function needs_shipping() on null in */wp-content/plugins/woocommerce-gateway-stripe/includes/payment-methods/class-wc-stripe-express-checkout-helper.php:629

The fix consists on checking the existence of the cart object before calling the needs_shipping method.

Testing instructions

Code review should be enough. If you want to test it:

  • Checkout and build this branch on your test environment (fix/fatal-error-editing-shortcode-checkout)
  • Make sure you are running your store on PHP 8.4
  • As a merchant, edit your shortcode checkout page (create one before if you don't have it)
  • Confirm no fatal errors are thrown

  • Covered with tests (or have a good reason not to test in description ☝️)
  • Added changelog entry in both changelog.txt and readme.txt (or does not apply)
  • Tested on mobile (or does not apply)

Post merge

@wjrosa wjrosa self-assigned this Jan 22, 2025
@wjrosa wjrosa marked this pull request as ready for review January 22, 2025 12:35
@wjrosa wjrosa requested a review from diegocurbelo January 22, 2025 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fatal error when editing the shortcode checkout page
1 participant