WC_Order::get_checkout_payment_url( bool $on_checkout = false )

Generates a URL so that a customer can pay for their (unpaid – pending) order. Pass ‘true’ for the checkout version which doesn’t offer gateway choices.


Description Description


Parameters Parameters

$on_checkout

(Optional) If on checkout.

Default value: false


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/class-wc-order.php

	public function get_checkout_payment_url( $on_checkout = false ) {
		$pay_url = wc_get_endpoint_url( 'order-pay', $this->get_id(), wc_get_checkout_url() );

		if ( $on_checkout ) {
			$pay_url = add_query_arg( 'key', $this->get_order_key(), $pay_url );
		} else {
			$pay_url = add_query_arg(
				array(
					'pay_for_order' => 'true',
					'key'           => $this->get_order_key(),
				),
				$pay_url
			);
		}

		return apply_filters( 'woocommerce_get_checkout_payment_url', $pay_url, $this );
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.