Automattic\WooCommerce\Admin\Features\Blueprint\Exporters

ExportWCSettingsSiteVisibility{}WC 1.0└─ StepExporter, HasAlias

Class ExportWCSettingsSiteVisibility

This class exports WooCommerce settings on the Site Visibility page.

No Hooks.

Usage

$ExportWCSettingsSiteVisibility = new ExportWCSettingsSiteVisibility();
// use class methods

Methods

  1. public check_step_capabilities()
  2. public export()
  3. public get_alias()
  4. public get_description()
  5. public get_label()
  6. public get_step_name()

Notes

  • Package: Automattic\WooCommerce\Admin\Features\Blueprint\Exporters

ExportWCSettingsSiteVisibility{} code WC 9.9.5

class ExportWCSettingsSiteVisibility implements StepExporter, HasAlias {
	use UseWPFunctions;

	/**
	 * Export Site Visibility settings.
	 *
	 * @return SetSiteOptions
	 */
	public function export() {
		return new SetSiteOptions(
			array(
				'woocommerce_coming_soon'      => $this->wp_get_option( 'woocommerce_coming_soon' ),
				'woocommerce_store_pages_only' => $this->wp_get_option( 'woocommerce_store_pages_only' ),
			)
		);
	}

	/**
	 * Get the alias for this exporter.
	 *
	 * @return string
	 */
	public function get_alias() {
		return 'setWCSettingsSiteVisibility';
	}

	/**
	 * Return label used in the frontend.
	 *
	 * @return string
	 */
	public function get_label() {
		return __( 'Site Visibility', 'woocommerce' );
	}

	/**
	 * Return description used in the frontend.
	 *
	 * @return string
	 */
	public function get_description() {
		return __( 'Includes all settings in WooCommerce | Settings | Visibility.', 'woocommerce' );
	}

	/**
	 * Get the name of the step.
	 *
	 * @return string
	 */
	public function get_step_name() {
		return 'setSiteOptions';
	}

	/**
	 * Check if the current user has the required capabilities for this step.
	 *
	 * @return bool True if the user has the required capabilities. False otherwise.
	 */
	public function check_step_capabilities(): bool {
		return current_user_can( 'manage_woocommerce' );
	}
}