0

I want to create a plugin that execute some code (an api call) after a client clicks a specific button in their wordpress.

Is it possible to make some button click execute my function ? If not i would like to do this at least with the "Pay" button in Woocommerce websites and of course prevent the default behaviour.

EDIT : The button i wanted to use is the pay button (confirm order). For my project i want to create a payment gateway. For WooCommerce i found this : https://rudrastyh.com/woocommerce/payment-gateway-plugin.html For other websites i will probably use unqueued Javascript. With some configuration in the client website it should work.

New contributor
KASMI G. is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
3
  • You mean PHP code? With or without reloading the page? Without you'd have to make an AJAX call to the admin-ajax endpoint or a REST API endpoint that would run your PHP code.
    – Rup
    Sep 14 at 22:09
  • I could do that for my own website with Ajax, but how could i make it work in any Wordpress just by installing m plugin ?
    – KASMI G.
    Sep 14 at 22:45
  • have you asked this in a woocommerce community? 3rd party plugin dev support is off topic here, if you need to extend WooCommerce payment buttons this is not an appropriate place to ask
    – Tom J Nowell
    Sep 15 at 0:18

Your Answer

KASMI G. is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.