Commit 287b8d017f for woocommerce
commit 287b8d017fbe270d6a29fd875364c0aa8e6d4ed3
Author: Risto Niinemets <risto.niinemets@gmail.com>
Date: Thu Jan 15 16:14:49 2026 +0200
Check if checkout page ID exists (#61847)
* Check if checkout page ID exists
* Add changelog and update PHPStan baseline
- Add changelog entry for the fix
- Remove stale PHPStan baseline entry that is no longer matched
---------
Co-authored-by: Michael Pretty <prettyboymp@users.noreply.github.com>
diff --git a/plugins/woocommerce/changelog/61847-fix-customizer-checkout-page-check b/plugins/woocommerce/changelog/61847-fix-customizer-checkout-page-check
new file mode 100644
index 0000000000..29415a75f5
--- /dev/null
+++ b/plugins/woocommerce/changelog/61847-fix-customizer-checkout-page-check
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Verify checkout page exists before adding customizer styles.
\ No newline at end of file
diff --git a/plugins/woocommerce/includes/customizer/class-wc-shop-customizer.php b/plugins/woocommerce/includes/customizer/class-wc-shop-customizer.php
index 1fcf549ea0..d65094e81a 100644
--- a/plugins/woocommerce/includes/customizer/class-wc-shop-customizer.php
+++ b/plugins/woocommerce/includes/customizer/class-wc-shop-customizer.php
@@ -946,6 +946,6 @@ class WC_Shop_Customizer {
*/
private function has_block_checkout() {
$post = get_post( get_option( 'woocommerce_checkout_page_id' ) );
- return strpos( $post->post_content, '<!-- wp:woocommerce/checkout' ) !== false;
+ return $post && strpos( $post->post_content, '<!-- wp:woocommerce/checkout' ) !== false;
}
}
diff --git a/plugins/woocommerce/phpstan-baseline.neon b/plugins/woocommerce/phpstan-baseline.neon
index 38de72da49..841b6ad2ee 100644
--- a/plugins/woocommerce/phpstan-baseline.neon
+++ b/plugins/woocommerce/phpstan-baseline.neon
@@ -20784,12 +20784,6 @@ parameters:
count: 1
path: includes/cli/class-wc-cli-update-command.php
- -
- message: '#^Cannot access property \$post_content on WP_Post\|null\.$#'
- identifier: property.nonObject
- count: 1
- path: includes/customizer/class-wc-shop-customizer.php
-
-
message: '#^Method WC_Shop_Customizer\:\:add_checkout_section\(\) has no return type specified\.$#'
identifier: missingType.return