0

I try to execute an external URL on this case a "payment proccess" when woocomerce subscription sends an email.

I want when Worpress send an mail to a customer the URL "https://payment-complete.com" for example, execute that url, this url is set to return a new state of the order.

TY!

Ruvee
  • 8,611
  • 4
  • 18
  • 44

1 Answers1

1

You can simply make use of WooCommerce hook. For this use case following can help:

function call_url(){
  $request = wp_remote_get( 'https://url-you-want-to-ping.tld/' );

  if( is_wp_error( $request ) ) {
    return false; // do what happens if request fails
  }
  return true; // do if request is successful.  
}

add_action( 'woocommerce_payment_complete', 'call_url' );

You can find about more hooks from here.