diff --git a/readme.txt b/readme.txt index 2f23637..7904374 100755 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=me%40 Tags: custom product attributes, woocommerce product attributes, product attributes, custom attributes, woocommerce custom product attributes Requires at least: 3.8 Tested up to: 4.7 -Stable tag: 1.5.1 +Stable tag: 1.5.2 License: GNU Version 2 or Any Later Version License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -117,6 +117,9 @@ Add this CSS: == Changelog == += 1.5.2 = +* Fix - Improve use of get_current_screen since it returns NULL in some cases. + = 1.5.1 = * Fix - Removed attributes from the admin main Orders page because it was ruining the HTML for the item names. @@ -182,6 +185,9 @@ Add this CSS: = 1.0 = * Initial release. == Upgrade Notice == += 1.5.2 = +Fix - Improve use of get_current_screen since it returns NULL in some cases. + = 1.5.1 = Fix - Removed attributes from the admin main Orders page because it was ruining the HTML for the item names. diff --git a/woocommerce-show-attributes.php b/woocommerce-show-attributes.php index 2443eeb..f89e6b6 100755 --- a/woocommerce-show-attributes.php +++ b/woocommerce-show-attributes.php @@ -3,7 +3,7 @@ Plugin Name: WooCommerce Show Attributes Plugin URI: https://isabelcastillo.com/docs/category/woocommerce-show-attributes Description: Show WooCommerce custom product attributes on the Product, Shop and Cart pages, admin Order Details page and emails. -Version: 1.5.1 +Version: 1.5.2 Author: Isabel Castillo Author URI: https://isabelcastillo.com License: GPL2 @@ -276,8 +276,11 @@ public function show_atts_on_product_page() { */ public function show_atts_on_customer_order( $item_name, $item ) { // Do not show this on the admin main Orders page - if ( function_exists( 'get_current_screen' ) && 'edit-shop_order' == get_current_screen()->id ) { - return $item_name; + if ( function_exists( 'get_current_screen' ) ) { + $screen = get_current_screen(); + if ( ! empty( $screen ) && isset( $screen->id ) && 'edit-shop_order' == $screen->id ) { + return $item_name; + } } $show_weight = null;