I need to execute some PHP for each product purchased (based on the ID), only on a successful checkout in WooCommerce. Does anyone know if this is possible, and if so – could you point me in the right direction?
Thanks!
I need to execute some PHP for each product purchased (based on the ID), only on a successful checkout in WooCommerce. Does anyone know if this is possible, and if so – could you point me in the right direction?
Thanks!
Comments are closed.
You could run a function on
woocommerce_payment_complete
. At that time you will have access to the$order_id
which you can then use to retrieve the products in the order: