Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
$post validation on Cart and Checkout template (#10410)
Browse files Browse the repository at this point in the history
Co-authored-by: Luigi Teschio <[email protected]>
  • Loading branch information
wavvves and gigitux committed Jul 31, 2023
1 parent e43afec commit 328db5d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Templates/CartTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static function get_placeholder_page() {
*/
protected function is_active_template() {
global $post;
return get_option( 'woocommerce_cart_page_endpoint' ) === $post->post_name;
return $post instanceof \WP_Post && get_option( 'woocommerce_cart_page_endpoint' ) === $post->post_name;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Templates/CheckoutTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ public static function get_template_title() {
*/
public function is_active_template() {
global $post;
return get_option( 'woocommerce_checkout_page_endpoint' ) === $post->post_name;
return $post instanceof \WP_Post && get_option( 'woocommerce_checkout_page_endpoint' ) === $post->post_name;
}
}

0 comments on commit 328db5d

Please sign in to comment.