hooks – Action called multiple times – WooCommerce


I’m using the woocommerce_payment_complete hook to send a request to web services. The function builds some info about the paid order then sends it to another server with wp_remote_post.

The issue I’m having is that the function that builds and sends the request is being called multiple times.

I’m logging each step inside the function and it logs multiple times (between two and three times, with a few milliseconds between each call).

One thing to note is that this only happens when clients pay with credit card.
We are using a plugin for credit card payments (MercadoPago).

How can I prevent the function from being called multiple times ?

JAGENI Nat 9 months 2022-05-06T14:08:29-05:00 0 Answers 0 views 0

Leave an answer