Thread Starter
code44
(@code44)
These can be also separated Mailchimp lists, so a two solutions:
1. Additional field to Maichlimp
or
2. Separated lists
Thanks in advance!
Plugin Contributor
Lap
(@lapzor)
If this field appears the same screen that has the MC4WP checkbox for newsletter subscription you could probably use some custom code to send it in:
https://github.com/ibericode/mc4wp-snippets/tree/master/integrations/woocommerce
eg: https://github.com/ibericode/mc4wp-snippets/blob/master/integrations/woocommerce/send-billing-fields.php
Hope that helps. If you have any questions, please let me know!
Hello,
Thank you for the answer Lap!
We have this extra field in our checkout form:
<input type=”hidden” name=”mc4wp-goal” id=”mc4wp-goal” value=”Goal Name”>
The field is named “GOAL” in Mailchimp.
We use code from the reference you sent us:
add_filter( ‘mc4wp_integration_woocommerce_data’, function( $data, $order_id ) {
$order = wc_get_order( $order_id );
$data[ ‘mc4wp-GOAL’ ] = $order->get_mc4wp-GOAL();
return $data;
}, 10, 2);
However, when we add the code to functions.php, woocommerce checkout giving us unknown warning (empty “woocommerce-error”) and order can’t be finished.
When we use this code below, payment works fine, however “GOAL” field is still empty in Mailchimp:
$data[ ‘mc4wp-GOAL’ ] = $order->get_meta( ‘mc4wp-GOAL’, true );
We tried many other ways, however field “GOAL” is always empty in Mailchimp. We would be grateful if you can suggest us any solution, how to send value from additional hidden field.
The goal is a Woocommerce product, however, it’s not a typical Woocommerce product, because it’s generated by Woocommerce Quick Donation plugin. So this is why we are “trying” with this extra field…
Best Regards
Hey @seba91,
Please create a new support post so the original post creator does not get notifications.
Hello, we are from the same company. The answer is related to the issue from first post. Best
Plugin Contributor
Lap
(@lapzor)
Please change the code to
$data[ 'GOAL' ] = $order->get_mc4wp-GOAL();
Hope that helps. If you have any questions, please let me know!