Automattic\WooCommerce\StoreApi\Schemas

ExtendSchema::get_payment_requirements()publicWC 1.0

Returns the additional payment requirements for the cart which are required to make payments. Values listed here are compared against each Payment Gateways "supports" flag.

{} Это метод класса: ExtendSchema{}

Хуков нет.

Возвращает

Массив. Returns a list of payment requirements.

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

$ExtendSchema = new ExtendSchema();
$ExtendSchema->get_payment_requirements( $requirements );
$requirements(массив)
list of requirements that should be added to the collected requirements.
По умолчанию: [ foo ]

Код ExtendSchema::get_payment_requirements() WC 6.8.0

public function get_payment_requirements( array $requirements = [ 'products' ] ) {
	if ( ! empty( $this->payment_requirements ) ) {
		foreach ( $this->payment_requirements as $callback ) {
			try {
				$data = $callback();

				if ( ! is_array( $data ) ) {
					throw new \Exception( '$data_callback must return an array.' );
				}

				$requirements = array_unique( array_merge( $requirements, $data ) );
			} catch ( \Throwable $e ) {
				$this->throw_exception( $e );
			}
		}
	}
	return $requirements;
}