WordPress как на ладони
Очень Удобный и Быстрый Хостинг для сайтов на WordPress. Пользуюсь сам и вам рекомендую!
класс не описан

Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks

Payments{} WC 1.0

Payments Task

Хуков нет.

Возвращает

null. Ничего.

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

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

Методы

  1. can_view()
  2. get_content()
  3. get_id()
  4. get_parent_id()
  5. get_time()
  6. get_title()
  7. has_gateways()
  8. is_complete()

Код Payments{} WC 6.1.0

class Payments extends Task {
	/**
	 * ID.
	 *
	 * @return string
	 */
	public function get_id() {
		return 'payments';
	}

	/**
	 * Parent ID.
	 *
	 * @return string
	 */
	public function get_parent_id() {
		$woocommerce_payments = new WooCommercePayments();
		return $woocommerce_payments->can_view() ? 'extended' : 'setup';
	}

	/**
	 * Title.
	 *
	 * @return string
	 */
	public function get_title() {
		$woocommerce_payments = new WooCommercePayments();
		return $woocommerce_payments->can_view()
			? __( 'Set up additional payment providers', 'woocommerce' )
			: __( 'Set up payments', 'woocommerce' );
	}

	/**
	 * Content.
	 *
	 * @return string
	 */
	public function get_content() {
		return __(
			'Choose payment providers and enable payment methods at checkout.',
			'woocommerce'
		);
	}

	/**
	 * Time.
	 *
	 * @return string
	 */
	public function get_time() {
		return __( '2 minutes', 'woocommerce' );
	}

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

	/**
	 * Task visibility.
	 *
	 * @return bool
	 */
	public function can_view() {
		return Features::is_enabled( 'payment-gateway-suggestions' );
	}

	/**
	 * Check if the store has any enabled gateways.
	 *
	 * @return bool
	 */
	public static function has_gateways() {
		$gateways         = WC()->payment_gateways->get_available_payment_gateways();
		$enabled_gateways = array_filter(
			$gateways,
			function( $gateway ) {
				return 'yes' === $gateway->enabled && 'woocommerce_payments' !== $gateway->id;
			}
		);

		return ! empty( $enabled_gateways );
	}
}