diff --git a/includes/admin/settings/class-wc-settings-api.php b/includes/admin/settings/class-wc-settings-api.php index 281e03a6b5f..d5e304c39b1 100644 --- a/includes/admin/settings/class-wc-settings-api.php +++ b/includes/admin/settings/class-wc-settings-api.php @@ -53,32 +53,37 @@ class WC_Settings_Rest_API extends WC_Settings_Page { /** * Get settings array. * + * @param string $current_section * @return array */ - public function get_settings() { - $settings = apply_filters( 'woocommerce_settings_rest_api', array( - array( - 'title' => __( 'General options', 'woocommerce' ), - 'type' => 'title', - 'desc' => '', - 'id' => 'general_options', - ), + public function get_settings( $current_section = '' ) { + $settings = array(); - array( - 'title' => __( 'API', 'woocommerce' ), - 'desc' => __( 'Enable the REST API', 'woocommerce' ), - 'id' => 'woocommerce_api_enabled', - 'type' => 'checkbox', - 'default' => 'yes', - ), + if ( '' === $current_section ) { + $settings = apply_filters( 'woocommerce_settings_rest_api', array( + array( + 'title' => __( 'General options', 'woocommerce' ), + 'type' => 'title', + 'desc' => '', + 'id' => 'general_options', + ), - array( - 'type' => 'sectionend', - 'id' => 'general_options', - ), - ) ); + array( + 'title' => __( 'API', 'woocommerce' ), + 'desc' => __( 'Enable the REST API', 'woocommerce' ), + 'id' => 'woocommerce_api_enabled', + 'type' => 'checkbox', + 'default' => 'yes', + ), - return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings ); + array( + 'type' => 'sectionend', + 'id' => 'general_options', + ), + ) ); + } + + return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section ); } /** diff --git a/includes/admin/settings/class-wc-settings-tax.php b/includes/admin/settings/class-wc-settings-tax.php index db58a627bf2..958390bd60b 100644 --- a/includes/admin/settings/class-wc-settings-tax.php +++ b/includes/admin/settings/class-wc-settings-tax.php @@ -73,10 +73,16 @@ class WC_Settings_Tax extends WC_Settings_Page { /** * Get settings array. * + * @param string $current_section * @return array */ - public function get_settings() { - return apply_filters( 'woocommerce_get_settings_' . $this->id, include( 'views/settings-tax.php' ) ); + public function get_settings( $current_section = '' ) { + $settings = array(); + + if ( '' === $current_section ) { + $settings = include( 'views/settings-tax.php' ); + } + return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section ); } /**