• Resolved lucari

    (@lucari)


    Hello,
    I’m trying to add Mailchimp interest groups (Language – Italian or English) to a Checkout subscription form.

    Following some examples online, I managed to display the subscribe checkbox with radio buttons for the interest groups.
    But when I test it, the email is subscribed to my Mailchimp with no group at all.
    The debug log does not display any error, and I tried to change the “Update existing subscribers?” and/or “Replace interest groups?” preferences in the Integrations > Woocommerce section, but nothing solved my issue.
    I added this to my functions.php, but I can’t get what I’ve done wrong.

    add_filter( 'mc4wp_integration_show_checkbox', 'mc4wp_show_interest_group_in_checkout' );
    function mc4wp_show_interest_group_in_checkout() { ?>
    	<p class="mc4wp-checkbox mc4wp-checkbox-woocommerce form-row form-row-wide woocommerce-validated"> px
    		<label>
    			<?php //<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1"> ?>
    			<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1" class="input-checkbox">
    			<span>Voglio anche iscrivermi alla newsletter per ricevere sconti e novità esclusive</span>
    		</label>
    	</p>
    	<!-- Interest Groups -->
    	<p class="form-row form-row " id="_mc4wp_subscribe_woocommerce_checkout_field" style="margin-top:-2em">
        <label>Linguaggio: </label> &nbsp;
        <label>
            <input name="mc4wp-INTERESTS[5d4daad2e9]" type="radio" value="2b9a4d01bc"> Italiano
        </label>&nbsp;
        <label>
            <input name="mc4wp-INTERESTS[5d4daad2e9]" type="radio" value="d590a2666d"> English
        </label>
    	</p>
    <?php
    }
    

    This is the page where I need help: https://bit.ly/3CKRv57

    Code reference:
    https://bit.ly/3IKlwGa
    https://bit.ly/3W0kVTC
    https://bit.ly/3W8k1Vh

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey @lucari,

    Can you please go to the “MC4WP > Others” menu and share with us any errors visible there?

    Thread Starter lucari

    (@lucari)

    sure!
    In the log I can see these errors, but they don’t seem related to my issue

    [2022-04-27 12:33:24]ERROR:Form 104 > Mailchimp API error: 400 Bad Request. Member Exists. ceru********@gm***.com is already a list member. Use PUT to insert or update list members.
    
    Request:
    
    POST https://us1.api.mailchimp.com/3.0/lists/7842b12821/members
    
    {"status":"pending","email_address":"ceru********@gm***.com","interests":{},"merge_fields":{},"email_type":"html","ip_signup":"188.14.57.243","tags":[]}
    
    Response:
    
    400 Bad Request
    
    {"title":"Member Exists","status":400,"detail":"ceru********@gm***.com is already a list member. Use PUT to insert or update list members.","instance":"481499c2-8e95-5f26-8588-3385be367fb9"}

    Very old message, it looks like a member tried to sign up more than once.

    [2023-01-08 07:27:01]ERROR:Form 104 > Mailchimp API error: 400 Bad Request. Invalid Resource. hich**@pr**********.ru has signed up to a lot of lists very recently; we're not allowing more signups for now
    
    Request:
    
    POST https://us1.api.mailchimp.com/3.0/lists/7842b12821/members
    
    {"status":"subscribed","email_address":"hich**@pr**********.ru","interests":{},"merge_fields":{},"email_type":"html","ip_signup":"213.142.147.251","tags":[]}
    
    Response:
    
    400 Bad Request
    
    {"type":"https://mailchimp.com/developer/marketing/docs/errors/","title":"Invalid Resource","status":400,"detail":"hich**@pr**********.ru has signed up to a lot of lists very recently; we're not allowing more signups for now","instance":"5ae2a540-88f1-4706-a4e7-c5474c4577d6"}
    

    Quite similar to the previous one, but this looks more like a bot-related issue.

    
    [2023-01-12 17:56:49]WARNING:Custom > No Mailchimp lists were selected
    
    [2023-01-12 18:02:23]WARNING:Custom > No Mailchimp lists were selected
    
    [2023-01-12 18:02:35]WARNING:Custom > No Mailchimp lists were selected

    These three displayed exactly when I was setting up the form and testing it. I noticed that I had selected no lists in MC4WP > Integrations > WooCommerce Checkout, which I did immediately after, and now these are my settings: https://ibb.co/bKxz21T

    Right now I checked once again all the IDs I used in my custom code, and they are correct, as I took the HTML from a form created with MC4WP (visible in the footer) which is working fine, and I just made little tweaks like adding the prefix mc4wp- to my input names

    <input name="mc4wp-INTERESTS[...]"
    Plugin Contributor Lap

    (@lapzor)

    Under MC4WP > Integration > Custom, can you please set the list you want to subscribe to?

    Then go to MC4WP > Other and empty the log, also set it to “log everything”.

    Then test it again and let us know what shows up in the log if it’s still not working.

    Hope that helps. If you have any questions, please let me know!

    Thread Starter lucari

    (@lucari)

    Hello @lapzor and thank you for your reply.
    I did as you suggested:
    – set the list in MC4WP > Integration > Custom
    – emptied the log and set to log everything
    – made a new test

    but basically nothing changed, the user is correctly subscribed to MailChimp, but has no preference group. This is the log message:

    [2023-01-16 11:13:56]INFO:WooCommerce Checkout > Successfully subscribed prova-16-1-2023@pr***.pro
    Plugin Contributor Lap

    (@lapzor)

    Let’s try via the custom integration method.

    In your custom code change

    <input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1" class="input-checkbox">

    to

    <input type="checkbox" name="mc4wp-subscribe" value="1" class="input-checkbox">

    And then test it again. Hope that works for you!

    Thread Starter lucari

    (@lucari)

    Hello @lapzor and thank you so much, it worked like a charm!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Interest groups radio buttons in Checkout page’ is closed to new replies.