Automattic\WooCommerce\Admin\Features\Blueprint\Exporters

ExportWCSettingsEmails{}WC 1.0└─ ExportWCSettings

Class ExportWCSettingsEmails

This class exports WooCommerce settings on the Emails page.

No Hooks.

Usage

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

Methods

  1. public export()
  2. public get_alias()
  3. public get_description()
  4. public get_label()
  5. protected get_page_id()

Notes

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

ExportWCSettingsEmails{} code WC 9.9.5

class ExportWCSettingsEmails extends ExportWCSettings {
	use UseWPFunctions;

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

	/**
	 * Export WooCommerce settings.
	 *
	 * @return SetSiteOptions
	 */
	public function export() {
		$emails          = \WC_Emails::instance();
		$setting_options = new SettingOptions();

		$email_settings = $setting_options->get_page_options( $this->get_page_id() );

		// Get sub-settings for each email.
		foreach ( $emails->get_emails() as $email ) {
			$email_settings = array_merge(
				$email_settings,
				$setting_options->get_page_options( 'email_' . $email->id )
			);
		}

		return new SetSiteOptions( $email_settings );
	}

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

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

	/**
	 * Get the page ID for the settings page.
	 *
	 * @return string
	 */
	protected function get_page_id(): string {
		return 'email';
	}
}