Add UTM fields to Webhook
-
Hi!
Thank you for your contribution with this great plugin.
I want to add the UTM fields that appear in the Woocommerce order to the “order.created” webhook.
I can modify this webhook from from functions.php, with something like this:
add_filter( ‘woocommerce_webhook_payload’, ‘modify_order_webhook_payload’, 10, 4 );
function modify_order_webhook_payload( $payload, $resource, $resource_id, $id )
{
$order = wc_get_order( $resource_id );
$utm_source = get_post_meta( $order , ‘[_YOUR FIELD NAME]‘ , true );
$payload[‘order’][‘utm_source’] = $utm_source ;
return $payload;
}How can I acces to your plugin fields ( or whats is the field’s name ) to be added this way?
Thank you very much.
- You must be logged in to reply to this topic.