id = 'alg_wc_left_to_free_shipping'; $this->label = __( 'Amount Left for Free Shipping', 'left-to-free-shipping-for-woocommerce' ); parent::__construct(); } /** * get_settings. * * @version 1.0.0 * @since 1.0.0 */ function get_settings() { global $current_section; return apply_filters( 'woocommerce_get_settings_' . $this->id . '_' . $current_section, array() ); } /** * maybe_reset_settings. * * @version 1.0.0 * @since 1.0.0 */ function maybe_reset_settings() { global $current_section; if ( 'yes' === get_option( $this->id . '_' . $current_section . '_reset', 'no' ) ) { foreach ( $this->get_settings() as $value ) { if ( isset( $value['default'] ) && isset( $value['id'] ) ) { delete_option( $value['id'] ); add_option( $value['id'], $value['default'], '', 'no' ); } } } } /** * Save settings. * * @version 1.0.0 * @since 1.0.0 */ function save() { parent::save(); $this->maybe_reset_settings(); } } endif; return new Alg_WC_Settings_Left_To_Free_Shipping();