Home / Archive / MemberPress: Auto-populate coupon on all registration forms
Duplicate Snippet

Embed Snippet on Your Site

MemberPress: Auto-populate coupon on all registration forms

Use this code to automatically apply a specified coupon code to all of the website's MemberPress registration pages.

The code should be modified by replacing the YOURCOUPON text with the actual coupon code on the following line:

c.val('YOURCOUPON');

Code Preview
php
<?php
function mepr_auto_populate_coupon() { 
?>
  <script>
  (function($) {
    $(document).ready(function() {
      var c = $('.mepr_coupon input.mepr-coupon-code');
      if(c) {
        // Paste coupon below to replace 'YOURCOUPON'
        c.val('YOURCOUPON');
      }
    });
  })(jQuery)
  </script>
<?php 
}
add_action( 'wp_head', 'mepr_auto_populate_coupon' );

Comments

Add a Comment