Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created November 15, 2017 08:17
Show Gist options
  • Save andrewlimaza/1e3344ab73458c40b812262198599f61 to your computer and use it in GitHub Desktop.
Save andrewlimaza/1e3344ab73458c40b812262198599f61 to your computer and use it in GitHub Desktop.
Mailchimp additional opt-in list check by default.
<?php
/**
* This snippet sets the additional opt-in lists for MailChimp to be selected on Paid Memberships Pro checkout page.
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function pmpro_mailchimp_check_by_default() {
global $pmpro_pages;
//only load this on the PMPro checkout page.
if( is_page( $pmpro_pages['checkout'] ) ) {
?>
<script>
jQuery(document).ready(function() {
jQuery('#additional_lists_1').prop('checked', true); //copy this and change the #additional_lists_1 to match the input checkbox ID's
});
</script>
<?php
}
}
add_action( 'wp_footer', 'pmpro_mailchimp_check_by_default' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment