Looking at around line 114 of the source of the CT Mailing list extension, it looks like the addon adds the content of the ['campaign_monitor']
key of $this->EE->cartthrob->cart->order('custom_data')
as part of the request to CampaignMonitor. The contents of this can be either a String or an Array, which suggests it's designed to permit multiple values to be sent to CM.
Quick aside: I find the CT docs are a little confusing as the suggest that when adding custom data to orders you can just use your custom field name name in your template rather than as custom_data['field_name']
the way you would for custom data on the save member form (though your custom field does need to exist in the back end for data to be saved). However looking at the source (Carttrob_core_ee.php, ~ line 548) I don't think you'd then still able to access these values via $this->EE->cartthrob->cart->order('custom_data')
. I could be wrong though.
I haven't had a chance to test that I've got the syntax right, but it looks to me like all you may need to do is add the relevant fields to your order via the checkout form, namespacing your values under campaign_monitor[]
(assuming you want to pass multiple values), so I think you either need
<input type="hidden" name="custom_data[campaign_monitor][custom_value_1]" value="{my_value_1}" />
<input type="hidden" name="custom_data[campaign_monitor][custom_value_2]" value="{my_value_1} />
or perhaps (but less likely):
<input type="hidden" name="campaign_monitor[custom_value_1]" value="{my_value_1}" />
<input type="hidden" name="campaign_monitor[custom_value_2]" value="{my_value_1} />
You can then set whatever data you need to send through to Campaign Monitor in your template.
If your data to send to CM always comes from the customer, you could probably also add the data via a simple custom extension using the cartthrob_save_customer_info_end
hook, but I'd probably start by just outputting the values in the template (or reading them from other user inputed fields on the fly with JavaScript) as it's probably faster to try out.