• Resolved Goran87

    (@goran87)


    Hey there,

    this support is amazing, so just to quickly ask one thing, when user clicks on paypal button to open modal, if error happens like user did not complete all required fields, is there a JS event that we could hook into to trigger our logic?

    We use default ones for forms that is not working anymore:
    $(document.body).on(‘checkout_error’, function (event, errorMessage) {


    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Clayton R

    (@mrclayton)

    Hi @goran87

    Apologies for the delayed response. Are you specifically looking for a client side event or would a server side action work?

    When one of the PayPal buttons is clicked, the plugin triggers this event:

    $(document.body).triggerHandler('wc_ppcp_on_click', [this, source]);

    Where source is the funding source like “paypal”, “card”, “paylater”, “venmo” etc.

    If there is an error, the plugin triggers this event:

    $(document.body).triggerHandler('wc_ppcp_on_error', [this, source, error]);

    I believe the `wc_ppcp_on_error’ is the event that you’re looking for.

    The reason you’re not seeing checkout_error is because you most likely have the plugin’s checkout field validation enabled. That means the plugin validates the checkout fields when the user clicks the PayPal button. You could turn that off and then validation wouldn’t occur until the checkout form is submitted and WooCommerce’s performs the validation during the checkout process.

    Kind Regards

    Thread Starter Goran87

    (@goran87)

    Exactly what I was looking, thanks!

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

The topic ‘Hook into PayPal button checkout errors’ is closed to new replies.