Support » Plugin: Easy Forms for Mailchimp » WooCommerce Checkout Opt-in Location

  • Resolved cikarang

    (@cikarang)


    Hello there,

    I’m trying to get the subscribe button on the checkout page but by default, it was placed on an illogical place. I’m wondering how to move it, preferably between the “Email Address” (last item in the Billing Details wrapper) and “Create an Account?” Hopefully it’s something that can be done through the functions.php file.

    Thank you very much for your help!

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @cikarang,

    Would you mind sending me a URL to your site? I want to see if the placement of the checkbox is being moved by your theme at all.

    Thanks,
    Kevin.

    Ambyomoron

    (@josiah-s-carberry)

    You might be aware that another plugin that offers functionality similar to this one allows you to specify where the checkbox appears on the form, relative to the various WooCommerce action hooks. This means that you can have it appear most anywhere on the page. I don’t know if the Yikes plugin offers the same possibility.

    Hi @yikesitskevin,

    The website is not yet live, so it’s still inaccessible. Hence, I’m wondering if the placement is accessible through hooks (actions and filters). If it is, may I know where to look for it so I can play around the hooks?

    Otherwise, what’d be the best way to get in touch with you to send access credentials?

    Cheers!

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @cikarang,

    There’s no filter to control where the field should go but I can certainly add one and get that out to you ASAP.

    I will get in contact with you later today.

    Cheers,
    Kevin.

    Hi @yikesitskevin,

    Alright, very cool.. Looking forward to hearing back from you!

    Cheers,
    Kevin

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @cikarang,

    I just looked into the code again and the checkbox is placed directly after the email address and before the account checkbox.

    Where is it settling on your checkout screen?

    Let me know,
    Kevin.

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @cikarang,

    I’ve added a filter but I don’t think it will be of much use to you. The filter controls where the field goes (e.g. after the ‘shipping’, ‘account’, ‘order’, or ‘billing’ information). It’s default is the ‘billing’ fields and based on your original question this is where you want the field to go anyway.

    I think this might be a theme/CSS issue.

    Cheers,
    Kevin.

    Plugin Author yikesinc

    (@yikesinc)

    Hi @cikarang,

    Just checking in.

    Do you need more help with this?

    Thank you!
    -Tracy

    Hi Tracy,

    Sorry for the late reply, I’m currently out of town so I haven’t been able to play around with it just yet. I’ll check this ASAP. Thank you!

    Cheers!
    Kevin

    Hi @yikesitskevin,

    Here’s where the prompt is shown:
    https://ibb.co/hvTKdw

    Any ideas on how I can override the calls so that it can be pushed down? Thank you!

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @cikarang,

    I have no idea how it’s showing up there but I completely understand why you want to move it. It should, by default, show on top of the “Create an Account” checkbox. I’m worried that your theme might be changing the way the default WooCommerce fields work but let’s try some things anyway.

    WooCommerce gives us four different field groups that we can hook into. The default one we’re using is “billing” (meaning the checkbox is supposed to appear after the billing details). “Billing” is clearly not working for you so let’s try our other three: “account”, “order”, and “customer”.

    Add this filter function to your functions.php file:

    add_filter( 'yikes-mailchimp-wooco-integration-checkbox-placement', 'yikes_mailchimp_move_woocommerce_integration_checkbox', 10, 1 );
    
    function yikes_mailchimp_move_woocommerce_integration_checkbox( $placement ) {
    	return 'order';
    }

    If this isn’t a good placement, try changing the return 'order'; line to return 'customer';, then try return 'account';

    For more information on the field groups we’re using, check out WooCommerce’s documentation: https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

    Let me know how that goes,
    Kevin.

    Hi @yikesitskevin,

    I’m able to use the ‘order’ to push it to the bottom of the page, so that’s nicely done. Thank you for your help!

    On a separate note, I noticed that the checkbox location is not on the left (how it shows up is still the same as in the previous screenshot). I tried looking for the proper CSS on the inspector but couldn’t find it :/ Any clues on this? Thanks again!

    Cheers!
    Kevin

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @cikarang,

    The HTML that is outputted for the checkbox is controlled by WooCommerce but it should look something like this:

    <p class="form-row form-row-wide woocommerce-validated" id="yikes_mailchimp_checkbox_woocommerce_checkout_form_field" data-priority="">
    				<label class="checkbox ">
    					<input type="checkbox" class="input-checkbox " name="1" id="yikes_mailchimp_checkbox_woocommerce_checkout_form" value="1" checked="checked"> 
    					Checkbox Label
    				</label>
    			</p>

    You can control the classes applied to the <p> element with the 'yikes-mailchimp-wooco-integration-checkbox-classes' filter (let me know if you’d like an example of how to add a custom class).

    You should be able to use CSS to control the styling of this <p> element.

    Let me know if that’ll work.

    Cheers,
    Kevin.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘WooCommerce Checkout Opt-in Location’ is closed to new replies.