diff --git a/includes/admin/class-wc-gzd-admin.php b/includes/admin/class-wc-gzd-admin.php index 660023504..6216ba74d 100644 --- a/includes/admin/class-wc-gzd-admin.php +++ b/includes/admin/class-wc-gzd-admin.php @@ -191,7 +191,7 @@ protected function check_enable_debug_mode() { } protected function check_disable_food_options() { - if ( 'yes' === get_option( 'woocommerce_gzd_disable_food_options' ) ) { + if ( ! WC_GZD_Food_Helper::enable_food_options() ) { update_option( 'woocommerce_gzd_disable_food_options', 'no' ); } else { update_option( 'woocommerce_gzd_disable_food_options', 'yes' ); diff --git a/includes/admin/views/html-page-status-germanized.php b/includes/admin/views/html-page-status-germanized.php index 9698bd189..74c1e5561 100644 --- a/includes/admin/views/html-page-status-germanized.php +++ b/includes/admin/views/html-page-status-germanized.php @@ -228,7 +228,7 @@ - + diff --git a/includes/class-wc-gzd-food-helper.php b/includes/class-wc-gzd-food-helper.php index 93d71986d..b02144278 100644 --- a/includes/class-wc-gzd-food-helper.php +++ b/includes/class-wc-gzd-food-helper.php @@ -8,6 +8,10 @@ public static function init() { } + public static function enable_food_options() { + return 'yes' !== get_option( 'woocommerce_gzd_disable_food_options' ); + } + public static function get_nutrient_reference_values() { return apply_filters( 'woocommerce_gzd_nutrient_reference_values', diff --git a/includes/class-wc-gzd-post-types.php b/includes/class-wc-gzd-post-types.php index 6d0e86aec..b5a3d4ca6 100644 --- a/includes/class-wc-gzd-post-types.php +++ b/includes/class-wc-gzd-post-types.php @@ -183,7 +183,7 @@ public static function register_taxonomies() { ) ); - if ( apply_filters( 'woocommerce_gzd_register_food_taxonomies', ( 'yes' !== get_option( 'woocommerce_gzd_disable_food_options' ) ) ) ) { + if ( apply_filters( 'woocommerce_gzd_register_food_taxonomies', WC_GZD_Food_Helper::enable_food_options() ) ) { // Deposit classes register_taxonomy( 'product_deposit_type', diff --git a/woocommerce-germanized.php b/woocommerce-germanized.php index f7e2ba2f1..766258d6c 100644 --- a/woocommerce-germanized.php +++ b/woocommerce-germanized.php @@ -1118,7 +1118,8 @@ public function add_inline_styles() { $custom_css .= ' p.woocommerce-shipping-destination { display: none; }'; } - $custom_css .= ' + if ( WC_GZD_Food_Helper::enable_food_options() ) { + $custom_css .= ' .wc-gzd-nutri-score-value-a { background: url(' . esc_url( $this->plugin_url() ) . '/assets/images/nutri-score-a.svg) no-repeat; } @@ -1135,6 +1136,7 @@ public function add_inline_styles() { background: url(' . esc_url( $this->plugin_url() ) . '/assets/images/nutri-score-e.svg) no-repeat; } '; + } wp_add_inline_style( 'woocommerce-gzd-layout', $custom_css ); }