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

Prevent showing our customer notices in WP Admin #10

Merged
merged 3 commits into from
Apr 16, 2020

Conversation

stevegrunwell
Copy link
Contributor

As WordPress.org user dennisdbn noticed, the customer-facing notice was attempting to display on the WooCommerce products page.

Unfortunately, this is a) unnecessary and b) difficult, considering the wc-notice-functions.php file is only loaded on front-end pages of a WooCommerce site.

This PR adds a quick is_admin() check, ensuring we abort early from OrderLimiter::customer_notice() if we're in WP Admin.

[As WordPress.org user dennisdbn noticed](https://wordpress.org/support/topic/php-call-to-undefined-function), the customer-facing notice was _attempting_ to display on the WooCommerce products page.

Unfortunately, this is a) unnecessary and b) difficult, considering the wc-notice-functions.php file is only loaded on front-end pages of a WooCommerce site.

This commit adds a quick `is_admin()` check, ensuring we abort early from `OrderLimiter::customer_notice()` if we're in WP Admin.
@stevegrunwell stevegrunwell added the bug Something isn't working label Apr 16, 2020
@stevegrunwell stevegrunwell added this to the Version 1.1.1 milestone Apr 16, 2020
@stevegrunwell stevegrunwell requested a review from bswatson April 16, 2020 15:12
The WordPress core test suite still doesn't support PHPUnit 8 and PHPUnit 7.x won't run on PHP 7.0, so we'll use PHPUnit 6 when testing the ancient version(s) of PHP but default to 7.x
@bswatson bswatson merged commit f938395 into develop Apr 16, 2020
@bswatson bswatson deleted the fix/customer-notice-in-admin branch April 16, 2020 15:34
@stevegrunwell stevegrunwell mentioned this pull request Apr 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants