WC_Settings_Products::get_settings_for_default_section()protectedWC 1.0

Get settings for the default section.

Метод класса: WC_Settings_Products{}

Возвращает

Массив.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_settings_for_default_section();

Код WC_Settings_Products::get_settings_for_default_section() WC 9.4.2

protected function get_settings_for_default_section() {
	$settings =
		array(
			array(
				'title' => __( 'Shop pages', 'woocommerce' ),
				'type'  => 'title',
				'desc'  => '',
				'id'    => 'catalog_options',
			),
			array(
				'title'    => __( 'Shop page', 'woocommerce' ),
				/* translators: %s: URL to settings. */
				'desc'     => sprintf( __( 'The base page can also be used in your <a href="%s">product permalinks</a>.', 'woocommerce' ), admin_url( 'options-permalink.php' ) ),
				'id'       => 'woocommerce_shop_page_id',
				'type'     => 'single_select_page',
				'default'  => '',
				'class'    => 'wc-enhanced-select-nostd',
				'css'      => 'min-width:300px;',
				'desc_tip' => __( 'This sets the base page of your shop - this is where your product archive will be.', 'woocommerce' ),
			),
			array(
				'title'         => __( 'Add to cart behaviour', 'woocommerce' ),
				'desc'          => __( 'Redirect to the cart page after successful addition', 'woocommerce' ),
				'id'            => 'woocommerce_cart_redirect_after_add',
				'default'       => 'no',
				'type'          => 'checkbox',
				'checkboxgroup' => 'start',
			),
			array(
				'desc'          => __( 'Enable AJAX add to cart buttons on archives', 'woocommerce' ),
				'id'            => 'woocommerce_enable_ajax_add_to_cart',
				'default'       => 'yes',
				'type'          => 'checkbox',
				'checkboxgroup' => 'end',
			),
			array(
				'title'       => __( 'Placeholder image', 'woocommerce' ),
				'id'          => 'woocommerce_placeholder_image',
				'type'        => 'text',
				'default'     => '',
				'class'       => '',
				'css'         => '',
				'placeholder' => __( 'Enter attachment ID or URL to an image', 'woocommerce' ),
				'desc_tip'    => __( 'This is the attachment ID, or image URL, used for placeholder images in the product catalog. Products with no image will use this.', 'woocommerce' ),
			),
			array(
				'type' => 'sectionend',
				'id'   => 'catalog_options',
			),

			array(
				'title' => __( 'Measurements', 'woocommerce' ),
				'type'  => 'title',
				'id'    => 'product_measurement_options',
			),

			array(
				'title'    => __( 'Weight unit', 'woocommerce' ),
				'desc'     => __( 'This controls what unit you will define weights in.', 'woocommerce' ),
				'id'       => 'woocommerce_weight_unit',
				'class'    => 'wc-enhanced-select',
				'css'      => 'min-width:300px;',
				'default'  => 'kg',
				'type'     => 'select',
				'options'  => array(
					'kg'  => I18nUtil::get_weight_unit_label( 'kg' ),
					'g'   => I18nUtil::get_weight_unit_label( 'g' ),
					'lbs' => I18nUtil::get_weight_unit_label( 'lbs' ),
					'oz'  => I18nUtil::get_weight_unit_label( 'oz' ),
				),
				'desc_tip' => true,
			),

			array(
				'title'    => __( 'Dimensions unit', 'woocommerce' ),
				'desc'     => __( 'This controls what unit you will define lengths in.', 'woocommerce' ),
				'id'       => 'woocommerce_dimension_unit',
				'class'    => 'wc-enhanced-select',
				'css'      => 'min-width:300px;',
				'default'  => 'cm',
				'type'     => 'select',
				'options'  => array(
					'm'  => I18nUtil::get_dimensions_unit_label( 'm' ),
					'cm' => I18nUtil::get_dimensions_unit_label( 'cm' ),
					'mm' => I18nUtil::get_dimensions_unit_label( 'mm' ),
					'in' => I18nUtil::get_dimensions_unit_label( 'in' ),
					'yd' => I18nUtil::get_dimensions_unit_label( 'yd' ),
				),
				'desc_tip' => true,
			),

			array(
				'type' => 'sectionend',
				'id'   => 'product_measurement_options',
			),

			array(
				'title' => __( 'Reviews', 'woocommerce' ),
				'type'  => 'title',
				'desc'  => '',
				'id'    => 'product_rating_options',
			),

			array(
				'title'           => __( 'Enable reviews', 'woocommerce' ),
				'desc'            => __( 'Enable product reviews', 'woocommerce' ),
				'id'              => 'woocommerce_enable_reviews',
				'default'         => 'yes',
				'type'            => 'checkbox',
				'checkboxgroup'   => 'start',
				'show_if_checked' => 'option',
			),

			array(
				'desc'            => __( 'Show "verified owner" label on customer reviews', 'woocommerce' ),
				'id'              => 'woocommerce_review_rating_verification_label',
				'default'         => 'yes',
				'type'            => 'checkbox',
				'checkboxgroup'   => '',
				'show_if_checked' => 'yes',
				'autoload'        => false,
			),

			array(
				'desc'            => __( 'Reviews can only be left by "verified owners"', 'woocommerce' ),
				'id'              => 'woocommerce_review_rating_verification_required',
				'default'         => 'no',
				'type'            => 'checkbox',
				'checkboxgroup'   => 'end',
				'show_if_checked' => 'yes',
				'autoload'        => false,
			),

			array(
				'title'           => __( 'Product ratings', 'woocommerce' ),
				'desc'            => __( 'Enable star rating on reviews', 'woocommerce' ),
				'id'              => 'woocommerce_enable_review_rating',
				'default'         => 'yes',
				'type'            => 'checkbox',
				'checkboxgroup'   => 'start',
				'show_if_checked' => 'option',
			),

			array(
				'desc'            => __( 'Star ratings should be required, not optional', 'woocommerce' ),
				'id'              => 'woocommerce_review_rating_required',
				'default'         => 'yes',
				'type'            => 'checkbox',
				'checkboxgroup'   => 'end',
				'show_if_checked' => 'yes',
				'autoload'        => false,
			),

			array(
				'type' => 'sectionend',
				'id'   => 'product_rating_options',
			),
		);

	$settings = apply_filters( 'woocommerce_products_general_settings', $settings );
	return apply_filters( 'woocommerce_product_settings', $settings );
}