InfusedWoo is pretty great plugin but if you are looking for some behind the scenes custom fields being added to the InfusionSoft, you might need to resort to writing some code as while you can have custom fields using InfusedWoo interface - they will be made visible to the customer so not ideal.

Luckily InfusedWoo provided me with a piece of code that is easy to expand.

add_filter( 'infusedwoo_contact_updateinfo', 'custom_add_totals_to_contactinfo', 10, 1 );

function custom_add_totals_to_contactinfo($contactinfo) {

}

I also found 2nd option where it pases not only contact info array but also WooCommerce order object. To do that use following code:

add_filter( 'infusedwoo_contact_updateinfo', 'custom_add_totals_to_contactinfo', 10, 2 );

function custom_add_totals_to_contactinfo($contactinfo, $order) {

}

here’s example how to use this:

function custom_add_totals_to_contactinfo($contactinfo, $order) {

// set order ID for InfusionSoft
$contactinfo['_sitelastorderid'] = $order->id;

// load site currency and total, and customer currency so we can pre-set it in our emails
$contactinfo['_siteordertotal'] = $order->get_total(); // returns paid amount after discount
$contactinfo['_sitecustomercurrencycode'] = $order->order_currency; //currency used by customer during checkout e.g. (EUR)

// return contactinfo as the code above only ads new custom fields and doesn't affect exiting core data
return $contactinfo;
}

The function has to return $contactinfo object for it to work.

Custom field names

There is also a thing to remember with custom fields, e.g. if you create field “myfield”, in the array you have to provide it as “_myfield” or else it wont be saved.

so this is how you populate field with name “sitelastorderid”

$contactinfo[’_sitelastorderid’] = $order->id;

Testing Problems

You might run into testing problems if you’re trying to perform to do testing with payments that doesn’t achieve “completed” status.

This still will send data to the InfusionSoft but NOT the custom fields! Make sure you don’t make the same mistake.

Not the best option but still one to consider is to test with 100% discount code.

Any questions - let me know!