Merge pull request #14784 from woocommerce/fix/14769
get_settings for shipping and checkout need to support sections for the API
This commit is contained in:
commit
c48ddfbab8
|
@ -61,7 +61,10 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_settings() {
|
public function get_settings( $current_section = '' ) {
|
||||||
|
$settings = array();
|
||||||
|
|
||||||
|
if ( '' === $current_section ) {
|
||||||
$settings = apply_filters( 'woocommerce_payment_gateways_settings', array(
|
$settings = apply_filters( 'woocommerce_payment_gateways_settings', array(
|
||||||
|
|
||||||
array(
|
array(
|
||||||
|
@ -244,8 +247,9 @@ class WC_Settings_Payment_Gateways extends WC_Settings_Page {
|
||||||
if ( wc_site_is_https() ) {
|
if ( wc_site_is_https() ) {
|
||||||
unset( $settings['unforce_ssl_checkout'] );
|
unset( $settings['unforce_ssl_checkout'] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -71,7 +71,10 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_settings() {
|
public function get_settings( $current_section = '' ) {
|
||||||
|
$settings = array();
|
||||||
|
|
||||||
|
if ( '' === $current_section ) {
|
||||||
$settings = apply_filters( 'woocommerce_shipping_settings', array(
|
$settings = apply_filters( 'woocommerce_shipping_settings', array(
|
||||||
|
|
||||||
array( 'title' => __( 'Shipping options', 'woocommerce' ), 'type' => 'title', 'id' => 'shipping_options' ),
|
array( 'title' => __( 'Shipping options', 'woocommerce' ), 'type' => 'title', 'id' => 'shipping_options' ),
|
||||||
|
@ -124,8 +127,9 @@ class WC_Settings_Shipping extends WC_Settings_Page {
|
||||||
array( 'type' => 'sectionend', 'id' => 'shipping_options' ),
|
array( 'type' => 'sectionend', 'id' => 'shipping_options' ),
|
||||||
|
|
||||||
) );
|
) );
|
||||||
|
}
|
||||||
|
|
||||||
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings );
|
return apply_filters( 'woocommerce_get_settings_' . $this->id, $settings, $current_section );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue