Doesn’t work with Paypal
-
We have an ecommerce, where is made the integration with mailchimp. When direct pay payment method is selected, everything is OK, but when user select PayPal, and pay for the goods, only FNAME, LNAME, EMAIL is saved in mailchimp. How can I add more fields to mailchimp?
Via direct payment everything is OK, via PayPal not.Here’s the code snippet
`add_filter( ‘mc4wp_integration_woocommerce_data’, function( $data ) {
foreach( WC()->cart->get_cart() as $cart_item ){
$product_var_name = array();
$product_id = $cart_item[‘variation_id’];
$product_name = (get_the_title($product_id));
//$product_var_name = str_replace(“Lístok na preteky”, “Lístok”, $product_name);
}// Grab Mailchimp field values from the current request
$data[‘SEX’] = sanitize_text_field( $_POST[‘billing_gender’] );
$data[‘BIRTHDATE’] = sanitize_text_field( $_POST[‘billing_birthdate’] );
$data[‘CITY’] = sanitize_text_field( $_POST[‘billing_city’] );
$data[‘ADDRESS’] = sanitize_text_field($_POST[‘billing_address_1’]);
$data[‘CATEGORY’] = sanitize_text_field($product_name);
$data[‘PHONE’] = sanitize_text_field($_POST[‘billing_phone’]);// Return the fields so the plugin knows to send them to Mailchimp
return $data;
});
- The topic ‘Doesn’t work with Paypal’ is closed to new replies.