WC_Order::get_checkout_payment_url
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.
Method of the class: WC_Order{}
Hooks from the method
Returns
String.
Usage
$WC_Order = new WC_Order(); $WC_Order->get_checkout_payment_url( $on_checkout );
- $on_checkout(true|false)
- If on checkout.
Default:false
WC_Order::get_checkout_payment_url() WC Order::get checkout payment url code WC 10.5.0
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 );
}