How to customize the "Allow users to sign up for your newsletter" text and checkbox state.

We are using the Mailchimp integration to allow customers to join the mailing list by using the option in the Templates=>Configuration page. We would like to change the text accompanying the checkbox to explain more about what our mailing list will do to provide value to the customer. We would also like to have the checkbox start out as being checked if at all possible.

We cannot find anywhere in the template where this is added before the automagicache, and would like to know what the best route would be to customize this text and checkbox. Should we just copy the div.fc-checkout__additional-field--subscribe and the inputs as they are placed on the page and insert them into the template prior to caching and disable the option on the configuration page, or would this mess up the script somehow?
Comments
  • We figured out a solution and my colleague will be posting it for future reference shortly.
  • We have solved this issue by running the following code in the footer scripts admin box:
    (function (FC, $){
    FC.json.config.lang.checkout_newsletter_subscribe = "NEW TEXT FOR CHECKBOX";

    FC.client.on('render.done', function(params, next) {
    jQuery('.fc-form-control--subscribe').attr('checked', 'checked');
    });
    })(FC, jQuery);
    This allows us to set the new label text for the newsletter_subscribe option and also on default checking the box when the page loads.

    ** disclaimer ** if the user does scroll down immediately and uncheck this will re-check on page render. Some conditional logic can be added to defeat this. (it serves our purpose)
  • fc_adamfc_adam FoxyCart Team
    edited November 2015
    @NetNut, @htmelvis,

    I'm glad you were able to find a solution. You don't need to use javascript to update the language strings though - any customer facing language strings are available from the "language" section of your store's FoxyCart administration. Within checkout look for "newsletter subscribe" for the checkbox label text.

    In terms of setting the checkbox to checked by default - one thing to keep in mind there, some services and countries do have rules and regulations surrounding the auto-opt-in, in some cases not allowed by law, but more generally not recommending it. That's why we haven't provided a configuration option for it's checked state ourselves, and I'd suggest ensuring that there isn't any issues with that where you're from too.
  • Thanks for the info on setting the text, and the warning on the checkbox state as well. As a developer I was unaware of those restrictions.
  • austindromanaustindroman Member
    edited August 2016
    @htmelvis
    I would like to use your code to checkmark the newsletter field by default. I tried copying and pasting it between




    in the checkout template,
    But this does not seem to work. Love your help.
    Thanks in advance

    -Austin
  • Looks like I commented out where I pasted your code. Lets try again
    <-!--- FC footer script insertion --.>
    (function (FC, $){
    FC.json.config.lang.checkout_newsletter_subscribe = "NEW TEXT FOR CHECKBOX";

    FC.client.on('render.done', function(params, next) {
    jQuery('.fc-form-control--subscribe').attr('checked', 'checked');
    });
    })(FC, jQuery);

    <-!-- /FC footer scripts --.>
  • fc_adamfc_adam FoxyCart Team
    @austindroman,

    Could you confirm what store you're trying to add this code to? Feel free to whisper it if you'd prefer to keep it private.
Sign In or Register to comment.