heatzzcircle
Forum Replies Created
-
Closed
Alright thank you @jpowersdev !
I’ll try my take on this! Will update if i manage to work something out.
But for now here’s my snippet for catching the WPML Language and adding it into a new Merge Field in Mailchimp!add_filter('yikes-mailchimp-filter-before-submission', function($merge_vars){ $my_current_lang= apply_filters( 'wpml_current_language', NULL ); // do nothing if WPML is not activated if( ! defined($my_current_lang ) ) { return $merge_vars; } $merge_vars[WPML_LANG] = substr($my_current_lang, 0, 2 ); return $merge_vars; });- This reply was modified 4 years, 8 months ago by heatzzcircle.
Hi Jon! This sort of works with a workaround (if I add the info into another merge field).
From my understanding, there is no Merge Field for the language field in Mailchimp. The Mailchimp Form gets this from detecting the browser language. The only way I see this working is by adding the browser language in the HTTP header of the API call.
Something like this.
headers: {'Accept-Language' => request.env['HTTP_ACCEPT_LANGUAGE']}Possibly something to consider adding to an update. Could you help me with that? Not entirely sure where the api call is made.