Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Contributor Lap

    (@lapzor)

    I’m not sure what kind of form I’m looking at in the screenshot. Can you share a link to where I can see this on your website?

    Thread Starter cloudres

    (@griotta)

    I’d prefer do not paste the web site. Sorry! But here it is another screenshot. I hope more clear right now. WooCommerce the first, Mailchimp for WooCommerce the second. I’d like to put the second checkbox before the first. Thanks ??

    Plugin Contributor Lap

    (@lapzor)

    Hi,
    The only options for changed the checkbox location are under MailChimp for WP > Integrations > WooCommerce checkout integration. You can switch the Position option there to hook into another spot, but we can’t control the order of things within that spot if other plugins hook into that spot too.

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

    Thread Starter cloudres

    (@griotta)

    Yes, I took a look to that feature in your plugin, but I think that it is better to put all checkboxes in the same location. So it’s fine as it is now. But I only want to change the order of the checkboxes.

    You said “but we can’t control the order of things within that spot if other plugins hook into that spot too”, but let me clarify please that there aren’t others plugins. I’m talking about WooCommerce Terms and Conditions checkbox.

    Is it really impossible to have a snippet to change the priority for your checkbox in that location?

    Thanks for your help.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    Please check the example code at https://github.com/ibericode/mc4wp-snippets/blob/master/integrations/woocommerce/custom-checkbox-html.php.

    You can use this as an example and then once you find the right hook in WooCommerce, you can use it in the example code to change position of the checkbox.

    Thread Starter cloudres

    (@griotta)

    @hchouhan thanks a lot for your help. Unfortunately I’m not a developer, so I don’t know how I can find the right hook. But as I told I just would like to put the Mailchimp for WooCommerce checkbox after the WooCommerce Terms & Conditions default checkbox.

    I took another screenshot to help you to understand what it is the situation right now (this time in English).

    Thanks again.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hello,

    Please try the following code.

    // 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 );
    
    // output custom html checkbox in checkout form
    add_action( 'woocommerce_checkout_after_terms_and_conditions', function() {
        // add HTML as you see fit here, but ensure the name and value of this element remains as it is
        echo '<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1" />';
    });

    To learn more about WooCommerce checkout page hooks, please check https://www.wpdesk.net/blog/woocommerce-checkout-hooks/#lightbox/0/. Customization is beyond the scope of our support so in future this could help you.

    Thread Starter cloudres

    (@griotta)

    This is the result. Mmm… something not work!

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey @griott,

    You will need to add the remaining text to the code I shared.

    The 2nd last line:

        echo '<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1" />';
    });

    Please add the text you want here including any custom CSS.

    Thread Starter cloudres

    (@griotta)

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey @griotta,

    I am not sure if I understood you. The screenshot just shows that you used the code I provided as it is.

    You need to customize it to add any additional text you want.

    So this:
    echo '<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1" />';

    Should become:
    echo '<input type="checkbox" name="_mc4wp_subscribe_woocommerce" value="1" /> Subscribe to our newsletter';

    And you can also add class names, labels, etc. If you are not sure how to do that, I would strongly recommend hiring a 3rd party developer.

    Thread Starter cloudres

    (@griotta)

    Yeah, maybe I did not explain well what I need ?? But I’d like to let you note that the order of checkboxes is the same of the start point.

    Start situation: 1) WooCommerce checkbox 2) Mailchimp for WooCommerce checkbox
    What I’d like to do: 1) Mailchimp for WooCommerce checkbox 2) WooCommerce checkbox
    What I see with your snippet: 1) WooCommerce checkbox 2) Mailchimp for WooCommerce checkbox

    If you can’t help me, thanks the same.

    Plugin Contributor Harish Chouhan

    (@hchouhan)

    Hey @griotta,

    Please change “woocommerce_checkout_after_terms_and_conditions” to “woocommerce_checkout_before_terms_and_conditions”

    Thread Starter cloudres

    (@griotta)

    Thanks a lot.

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Change the order to checkboxes’ is closed to new replies.