Sending Woocommerce Product name to Pipedrive

spacefox Member Posts: 1
edited November 2022 in Apps and Integrations #1

I am trying to send a Deal to Pipedrive after a successfull purchase, this is working fine but I am trying to send the name of the product aswell to Pipedrive and this is giving me an error. Any advice would be appreciated.

I tried to use global $products and global $post to get any info of the product but it always gave me an eerror back

add_action('woocommerce_order_status_changed', 'pdrive_deal');

function pdrive_deal() {
global $products;
$product = wc_get_product( 'ID' );
$token = 'XXXXXXXXX';
$company_domain = 'Name';
$deal = array(
  'title' => $product . ' Deal'
$url = 'https://' . $company_domain . '' . $token;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $deal);
$output = curl_exec($ch);


This discussion has been closed.