• Hi,

    In Pay now form we have custom checkboxes which should be checked during checkout. Unfortunately your current code only checks terms and terms-field:

    modules/ppcp-button/src/Endpoint/CreateOrderEndpoint.php

    private function validate_paynow_form( array $form_fields ): void {
    		if ( isset( $form_fields['terms-field'] ) && ! isset( $form_fields['terms'] ) ) {
    			throw new ValidationException(
    				array( __( 'Please read and accept the terms and conditions to proceed with your order.', 'woocommerce-paypal-payments' ) )
    			);
    		}
    	}

    There is a change to add some action here so I will be able to validate other fields in pay now form?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Krystian Syde

    (@inpsydekrystian)

    Hello @dziudek

    This article should help you: https://github.com/woocommerce/woocommerce-paypal-payments/wiki/Common-errors#custom-field-not-validated-when-clicking-the-paypal-button

    From your code, it’s not clear when the field validation is happening. Ideally, you should validate during the woocommerce_after_checkout_validation hook.

    Please reach out if you have any more questions.

    Kind regards,
    Krystian

    Thread Starter Tomasz Dziuda

    (@dziudek)

    Hi @inpsydekrystian ,

    Ihe mentioned webhook is not called in context which I need – I want to avoid situation when customer does not check my required checkboxes and then it is validated after making payment in PayPal.

    Please also note, that I am not referring to the standard checkout view – there my custom checkboxes are properly validated via your plugin. I have a problem with a manual payment link 🙂 Used in woocommerce/checkout/form-pay.php

    Plugin Support Krystian Syde

    (@inpsydekrystian)

    Hello @dziudek,

    Yeah, this is a bit tricky. We don’t have a straightforward solution at the moment. We’ve created a Jira issue for this and assigned this thread to it.

    Once we receive updates on it, I’ll reach out to you.

    Kind regards,
    Krystian

    Thread Starter Tomasz Dziuda

    (@dziudek)

    Hi @inpsydekrystian

    Thank you, at this moment I am using custom change in the plugin code, but definitely some custom action available inside this code fragment will be much more elegant solution!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Pay now form – additional action needed’ is closed to new replies.