Automattic\WooCommerce\Blocks\Domain\Services

CheckoutLink::handle_checkout_link_endpointpublicWC 1.0

Handle the checkout link endpoint.

Метод класса: CheckoutLink{}

Хуков нет.

Возвращает

null. Ничего (null).

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

$CheckoutLink = new CheckoutLink();
$CheckoutLink->handle_checkout_link_endpoint();

Код CheckoutLink::handle_checkout_link_endpoint() WC 11.0.1

public function handle_checkout_link_endpoint() {
	if ( ! get_query_var( 'checkout-link' ) ) {
		return;
	}

	if ( ! $this->validate_checkout_link() ) {
		$redirect = add_query_arg( 'wc_error', rawurlencode( __( 'The provided checkout link was out of date or invalid. No products were added to the cart.', 'woocommerce' ) ), wc_get_cart_url() );
	} else {
		wc()->cart->empty_cart();
		$redirect = $this->get_checkout_link();
	}

	wp_safe_redirect( $redirect );
	exit;
}