WC_Install::create_options() – Default options.

You appear to be a bot. Output may be restricted

Description

Default options.

Sets up the default options used on the settings page.

Usage

WC_Install::create_options();

Parameters

Returns

void

Source

File name: woocommerce/includes/class-wc-install.php


Lines:

1 to 41 of 41
  private static function create_options() {
    // Include settings so that we can run through defaults.
    include_once dirname( __FILE__ ) . '/admin/class-wc-admin-settings.php';

    $settings = WC_Admin_Settings::get_settings_pages();

    foreach ( $settings as $section ) {
      if ( ! method_exists( $section, 'get_settings' ) ) {
        continue;
      }
      $subsections = array_unique( array_merge( array( '' ), array_keys( $section->get_sections() ) ) );

      
/**
 * We are using 'WC_Settings_Page::get_settings' on purpose even thought it's deprecated.
 * See the method documentation for an explanation.
 */

      foreach ( $subsections as $subsection ) {
        foreach ( $section->get_settings( $subsection ) as $value ) {
          if ( isset( $value['default'] ) && isset( $value['id'] ) ) {
            $autoload = isset( $value['autoload'] ) ? (bool) $value['autoload'] : true;
            add_option( $value['id'], $value['default'], '', ( $autoload ? 'yes' : 'no' ) );
          }
        }
      }
    }

    // Define other defaults if not in setting screens.
    add_option( 'woocommerce_single_image_width', '600', '', 'yes' );
    add_option( 'woocommerce_thumbnail_image_width', '300', '', 'yes' );
    add_option( 'woocommerce_checkout_highlight_required_fields', 'yes', '', 'yes' );
    add_option( 'woocommerce_demo_store', 'no', '', 'no' );

    if ( self::is_new_install() ) {
      // Define initial tax classes.
      WC_Tax::create_tax_class( __( 'Reduced rate', 'woocommerce' ) );
      WC_Tax::create_tax_class( __( 'Zero rate', 'woocommerce' ) );
    }
  }
 

 View on GitHub View on Trac