• nilesh6018

    (@nilesh6018)


    Hello Support Team,

    I hope you are doing well,

    We are using your PayPal Payment plugin and this plugin works extremely good, We are encountering an issue with payment when using additional privacy policy fields which we added. When a user makes a payment via PayPal, these fields are not validated before the payment is processed. However, when the user returns to the checkout, the fields are validated but I need to remove this scenario. I’ve tried multiple solutions using hooks, filters, and jQuery, but nothing has worked.

    I also used the filter provided by the plugin, “wc_ppcp_checkout_validation_fields,” but it not validates the fields after the payment is completed. Additionally, after payment, my custom field is unchecked, which triggers an error. I need the fields to be validated at the time of payment, not during the second attempt after the payment is already done.

    We are displaying this additional fields just before Payment option please check this image https://prnt.sc/M19Dx81p_nUy

    Can you please help me to fix this issue as soon as possible? I am facing this issue specifically with PayPal Checkout or please provide me the solution for this.

    Thanks,
    Nilesh

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Payment Plugins

    (@mrclayton)

    Hi @nilesh6018

    these fields are not validated before the payment is processed.

    That is not a correct statement. The payment is never processed until all required fields are validated since WooCommerce performs a server side validation of all required fields before the plugin is called.

    Also, the payment is not finalized when the PayPal popup is visible. Payment finalization occurs server side after the checkout form submits.

    Can you please help me to fix this issue as soon as possible?

    Can you share what custom code you wrote using filter wc_ppcp_checkout_validation_fields? If written correctly, that should be all you need to properly trigger the validation.

    Did you make sure to turn on field validation via the Advanced Settings page of the PayPal plugin?

    Kind Regards

    Thread Starter nilesh6018

    (@nilesh6018)

    Thank you for your prompt replay,

    We are use additional WooCommerce fields just before Place order button, does this field validate before I place an order using PayPal method?

    add_action('woocommerce_review_order_before_submit', 'display_country_based_checkbox');
    function display_country_based_checkbox() {

    woocommerce_form_field( 'conformation', array(
    'type' => 'checkbox',
    'class' => array('form-row conformation'),
    'label_class' => array('woocommerce-form__label woocommerce-form__label-for-checkbox checkbox'),
    'input_class' => array('woocommerce-form__input woocommerce-form__input-checkbox input-checkbox'),
    'required' => true,
    'label' => 'Der Versand von durchgeführten Tests aus anderen L?ndern nach Deutschland erfolgt auf die Kosten der Kundin. Der Betrag kann je nach Land abweichen.',
    ));
    }

    also I validate field using this method

    add_action('woocommerce_checkout_process', 'validate_country_checkbox_field');
    function validate_country_checkbox_field() {
    // Get the posted value of the checkbox
    $checkbox_value = isset($_POST['conformation']) ? $_POST['conformation'] : '';

    wc_add_notice(__('Der Versand von durchgeführten Tests aus anderen L?ndern nach Deutschland erfolgt auf die Kosten der Kundin. Der Betrag kann je nach Land abweichen.'), 'error');

    }
    • This reply was modified 1 month ago by nilesh6018.
    Plugin Author Payment Plugins

    (@mrclayton)

    Hi @nilesh6018

    In your OP you said you were using filter wc_ppcp_checkout_validation_fields. Please share the custom code you wrote for that filter.

    does this field validate before I place an order using PayPal method?

    No, you haven’t told WooCommerce that field exists and that it should be validated. The proper filter to tell WooCommerce to validate your field is woocommerce_checkout_fields.

    But you don’t need to use woocommerce_checkout_fields if you use the PayPal plugin filter correctly. I personally think wc_ppcp_checkout_validation is the best filter for you to use.

    Kind Regards

    Thread Starter nilesh6018

    (@nilesh6018)

    Than you for the clarification can you please provide me an example with the use of ” wc_ppcp_checkout_validation “?

    I will try from my side and I will let you know if I face an issue after use the ” wc_ppcp_checkout_validation “.

    Plugin Author Payment Plugins

    (@mrclayton)

    add_action('wc_ppcp_checkout_validation', function($validator, $request){
    if(empty($request['conformation'])){
    $validator->add_error('Conformation checkbox is a required field.');
    }
    }, 10, 2);
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.