From 0ca152fa0d4f2ddee6571957d334a3493899da21 Mon Sep 17 00:00:00 2001 From: Marianne380 Date: Sat, 3 Aug 2024 02:10:57 +0200 Subject: [PATCH] [Enhancement] Create new filter `woocommerce_is_store_page` for filtering if the URL is a store page. (#50174) Create a new filter woocommerce_is_store_page for filtering if the URL is a store page. Fixes #50173 * Create new filter for filtering if the URL is a store page * Fix brace * Update plugins/woocommerce/src/Admin/WCAdminHelper.php Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com> * Add changefile(s) from automation for the following project(s): woocommerce * Remove extra whitespace --------- Co-authored-by: Corey McKrill <916023+coreymckrill@users.noreply.github.com> Co-authored-by: github-actions --- plugins/woocommerce/changelog/50174-fix-50173 | 4 ++++ plugins/woocommerce/src/Admin/WCAdminHelper.php | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 plugins/woocommerce/changelog/50174-fix-50173 diff --git a/plugins/woocommerce/changelog/50174-fix-50173 b/plugins/woocommerce/changelog/50174-fix-50173 new file mode 100644 index 00000000000..f51740dbb97 --- /dev/null +++ b/plugins/woocommerce/changelog/50174-fix-50173 @@ -0,0 +1,4 @@ +Significance: minor +Type: enhancement + +Add filter `woocommerce_is_store_page` to modify whether Coming Soon mode considers a URL a store page or not. \ No newline at end of file diff --git a/plugins/woocommerce/src/Admin/WCAdminHelper.php b/plugins/woocommerce/src/Admin/WCAdminHelper.php index d46ade4b723..91d3c8ac02f 100644 --- a/plugins/woocommerce/src/Admin/WCAdminHelper.php +++ b/plugins/woocommerce/src/Admin/WCAdminHelper.php @@ -230,7 +230,16 @@ class WCAdminHelper { } } - return false; + /** + * Filter if a URL is a store page. + * + * @since 9.3.0 + * @param bool $is_store_page Whether or not the URL is a store page. + * @param string $url URL to check. + */ + $is_store_page = apply_filters( 'woocommerce_is_store_page', false, $url ); + + return filter_var( $is_store_page, FILTER_VALIDATE_BOOL ); } /**