Ensure terms and conditions page is selected before validate

This commit is contained in:
dinamiko 2021-01-07 12:37:16 +01:00
parent 8562fb7f58
commit 9bf0248153

View file

@ -175,7 +175,7 @@ class CreateOrderEndpoint implements EndpointInterface {
if ( 'checkout' === $data['context'] ) {
$this->validate_checkout_form( $data['form'], $order );
}
if ( 'pay-now' === $data['context'] ) {
if ( 'pay-now' === $data['context'] && get_option( 'woocommerce_terms_page_id', '' ) !== '' ) {
$this->validate_paynow_form( $data['form'] );
}
wp_send_json_success( $order->to_array() );