• Resolved mvs-one

    (@mikesv-one)


    Is it possible at all (on either free or premium) to allow a user to select which segment they’re added to? We’d like to have something like

    ■ Send me store offers
    ■ Send me magazine news

    When checking out on Woocommerce

    But so far it seems only possible for a user to subscribe to all segments at once. Is that correct?

    Cheers!

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

    (@hchouhan)

    Hello,

    Thanks for reaching out to us.

    This would be possible in both the free & premium plugin but would require additional code. Please find some code example below which you can modify and add to the “functions.php” file inside your active theme folder.

    // stop outputting default plugin checkbox
    add_filter( 'mc4wp_integration_show_checkbox', function( $show, $integration_slug ) {
    	if( $integration_slug == 'woocommerce' ) { return false; }
    	return $show;
    }, 10, 2 );
    
    /**
     * This snippet adds the HTML for a MailChimp interest groups to your WooCommerce checkout.
     */
    //add_action( 'woocommerce_after_order_notes', 'mc4wp_show_interest_group_in_checkout' );
    function mc4wp_show_interest_group_in_checkout() { ?>
    
    	<!-- Subscription Checkbox -->
    	<p class="mc4wp-checkbox mc4wp-checkbox-woocommerce">
    		<label>
    			<?php //<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1"> ?>
    			<input type="checkbox" name="mc4wp-subscribe" value="1">
    			<span>Sign me up for the newsletter YAY!</span>
    		</label>
    	</p>
    
    	<!-- Interest Groups -->
    	<p class="form-row form-row " id="_mc4wp_subscribe_woocommerce_checkout_field">
    		<span>Choose the topic of your interest</span><br />
    		<label class="checkbox ">
    			<input name="mc4wp-INTERESTS[XXXX][]" type="checkbox" value="ENTER-VALUE"> <span>Theme</span>
    			<input name="mc4wp-INTERESTS[XXXX][]" type="checkbox" value="ENTER-VALUE"> <span>Plugin</span>
    		</label>
    	</p>
    
    <?php
    }
    Thread Starter mvs-one

    (@mikesv-one)

    Hi Harish,

    Thanks for getting back to me.

    What is the correct syntax for the checkboxes?

    If I have a segment ID of 9988

    <input name="mc4wp-INTERESTS[9988][]" type="checkbox" value="ENTER-VALUE"> <span>Plugin</span>

    Is this correct? Also what needs to be set as value

    The fields are rendering correctly on the checkout, but nothing gets sent to Mailchimp.

    Thanks again,

    Mike

    • This reply was modified 7 years, 2 months ago by mvs-one. Reason: Additional information
    Thread Starter mvs-one

    (@mikesv-one)

    Hi Harish,

    I’m having an issue still getting this working. I know what the input syntax should be and got the correct Group and Interest IDs, but now when the form is submitted, there’s a “WARNING: Custom > No Mailchimp lists were selected” error in the log.

    The inputs are set up like this

    ` <input name=”mc4wp-INTERESTS[GROUP-ID][]” type=”checkbox” value=”INTEREST-ID”> <span>Option 1</span>

    Is there anywhere I need to add the list ID as well?

    Hope you can get back to me.

    Thanks again.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    I apologize for the delay in replying.

    The error just means you have not selected a list for the “WooCommerce Checkout” integration. You can do so by going to “MailChimp for WP > Integrations” menu, then click on “WooCommerce Checkout” and then select a list and save.

    Thread Starter mvs-one

    (@mikesv-one)

    Hi Harish,

    Thanks for getting back to me.

    I have definitely selected a list in the integrations settings for Woocommerce. When not using your code the form works normally and adds the customer to the correct list. The error only happens when using your code.

    Mike

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey Mike,

    Sorry about that. Can you please try going to the “Custom Integration” in the integration list, select a list there and set up the same settings as “WooCommerce Checkout” integration and test again? Please let me know if that works.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    There have been no replies to this topic, so I’m marking this as resolved. Please do let us know if you’re still experiencing an issue.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Segment selection for Woocommerce integration?’ is closed to new replies.