From abd3f521ecab9be006a7594433ed98d6f966d749 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Thu, 10 Jan 2013 16:37:27 +0000 Subject: [PATCH] Hide tax options when disabled. Closes #2205. --- .../writepanels/variation-admin-html.php | 2 ++ .../writepanels/writepanel-product_data.php | 36 ++++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/admin/post-types/writepanels/variation-admin-html.php b/admin/post-types/writepanels/variation-admin-html.php index bbc061a5ef6..a7670d7b12d 100644 --- a/admin/post-types/writepanels/variation-admin-html.php +++ b/admin/post-types/writepanels/variation-admin-html.php @@ -120,11 +120,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly echo wp_dropdown_categories( $args ); ?> + + diff --git a/admin/post-types/writepanels/writepanel-product_data.php b/admin/post-types/writepanels/writepanel-product_data.php index 54c683d7c96..4487902a38a 100644 --- a/admin/post-types/writepanels/writepanel-product_data.php +++ b/admin/post-types/writepanels/writepanel-product_data.php @@ -170,27 +170,31 @@ function woocommerce_product_data_box() { echo ''; - echo '
'; + if ( get_option( 'woocommerce_calc_taxes' ) == 'yes' ) { - // Tax - woocommerce_wp_select( array( 'id' => '_tax_status', 'label' => __( 'Tax Status', 'woocommerce' ), 'options' => array( - 'taxable' => __( 'Taxable', 'woocommerce' ), - 'shipping' => __( 'Shipping only', 'woocommerce' ), - 'none' => __( 'None', 'woocommerce' ) - ) ) ); + echo '
'; - $tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) ); - $classes_options = array(); - $classes_options[''] = __( 'Standard', 'woocommerce' ); - if ( $tax_classes ) - foreach ( $tax_classes as $class ) - $classes_options[ sanitize_title( $class ) ] = esc_html( $class ); + // Tax + woocommerce_wp_select( array( 'id' => '_tax_status', 'label' => __( 'Tax Status', 'woocommerce' ), 'options' => array( + 'taxable' => __( 'Taxable', 'woocommerce' ), + 'shipping' => __( 'Shipping only', 'woocommerce' ), + 'none' => __( 'None', 'woocommerce' ) + ) ) ); - woocommerce_wp_select( array( 'id' => '_tax_class', 'label' => __( 'Tax Class', 'woocommerce' ), 'options' => $classes_options ) ); + $tax_classes = array_filter( array_map( 'trim', explode( "\n", get_option( 'woocommerce_tax_classes' ) ) ) ); + $classes_options = array(); + $classes_options[''] = __( 'Standard', 'woocommerce' ); + if ( $tax_classes ) + foreach ( $tax_classes as $class ) + $classes_options[ sanitize_title( $class ) ] = esc_html( $class ); - do_action( 'woocommerce_product_options_tax' ); + woocommerce_wp_select( array( 'id' => '_tax_class', 'label' => __( 'Tax Class', 'woocommerce' ), 'options' => $classes_options ) ); - echo '
'; + do_action( 'woocommerce_product_options_tax' ); + + echo '
'; + + } do_action( 'woocommerce_product_options_general_product_data' ); ?>