PHP Notice

I'm getting a PHP notice from line 273, can we fix this?  See below.

 

Trying to get property of non-object 1 wp-content/plugins/woocommerce-shop-as-customer/shop-as-customer.php:273 WC_Shop_As_Customer->enqueue_scripts()
 wp-content/plugins/woocommerce-shop-as-customer/shop-as-customer.php:273Trying to get property of non-object 1 wp-content/plugins/woocommerce-shop-as-customer/shop-as-customer.php:273 WC_Shop_As_Customer->enqueue_scripts() wp-content/plugins/woocommerce-shop-as-customer/shop-as-customer.php:273
Add Comment
5 Answer(s)

Thanks for this... I'll pass this thread on to the dev to sort out.

Thanks

Answered on September 26, 2016.
Add Comment

Apologies for the delay, we are fixing this now.

Stuart

Answered on September 28, 2016.
Add Comment

This one is painful since it messes up other features and plugins.

The fix is simple. The line 273 just needs to be replaced with this

 if (is_admin() && isset($screen) && 'settings_page_shop_as_customer_settings' == $screen->id) {
 

Explanation: the global $screen is not always defined so it needs to be tested before retrieving the id.

 

Michael

Answered on September 23, 2016.
Add Comment

Thank you Michael.

Answered on September 23, 2016.
Add Comment

Thanks Stuart, this way we can update to the next version without having to worry 🙂

Answered on September 28, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.