Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

ExperimentalShippingRecommendation{}WC 1.0

Shipping Task

Хуков нет.

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

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

Методы

  1. public can_view()
  2. public get_action_url()
  3. public get_content()
  4. public get_id()
  5. public get_time()
  6. public get_title()
  7. public static has_jetpack_connected()
  8. public static has_plugins_active()
  9. public is_complete()

Код ExperimentalShippingRecommendation{} WC 9.3.3

class ExperimentalShippingRecommendation extends Task {
	/**
	 * ID.
	 *
	 * @return string
	 */
	public function get_id() {
		return 'shipping-recommendation';
	}

	/**
	 * Title.
	 *
	 * @return string
	 */
	public function get_title() {
		return __( 'Get your products shipped', 'woocommerce' );
	}

	/**
	 * Content.
	 *
	 * @return string
	 */
	public function get_content() {
		return '';
	}

	/**
	 * Time.
	 *
	 * @return string
	 */
	public function get_time() {
		return '';
	}

	/**
	 * Task completion.
	 *
	 * @return bool
	 */
	public function is_complete() {
		return self::has_plugins_active() && self::has_jetpack_connected();
	}

	/**
	 * Task visibility.
	 *
	 * @return bool
	 */
	public function can_view() {
		return Features::is_enabled( 'shipping-smart-defaults' ) &&
			! PluginsHelper::is_plugin_active( 'woocommerce-shipping' ) &&
			! PluginsHelper::is_plugin_active( 'woocommerce-tax' );
	}

	/**
	 * Action URL.
	 *
	 * @return string
	 */
	public function get_action_url() {
		return '';
	}

	/**
	 * Check if the store has any shipping zones.
	 *
	 * @return bool
	 */
	public static function has_plugins_active() {
		return PluginsHelper::is_plugin_active( 'woocommerce-services' );
	}

	/**
	 * Check if the Jetpack is connected.
	 *
	 * @return bool
	 */
	public static function has_jetpack_connected() {
		$jetpack_connection_manager = new Manager( 'woocommerce' );

		return $jetpack_connection_manager->is_connected() && $jetpack_connection_manager->has_connected_owner();
	}
}