Posted: May 15, 2014 at 3:10 am
|
Hi, i would like to know if I can pre-populate / pre-apply the promotional codes using embedded URL or any other method. Lets say I created codes : dis50 Event Espresso version : 3.1.36.5.P |
|
Hi, Pre applying will be quite hard, but pre-populating is fairly easy. Add the following function to wp-content/uploads/espresso/custom_functions.php (you may need to create this if it does not already exist, or use a custom plugin). <?php //delete this if it already exists at the top of the custom_functions.php file function event_espresso_coupon_registration_page( $use_coupon_code = 'N', $event_id, $class =' ee-reg-page-text-input ', $multi_reg = FALSE ) { global $espresso_premium; if ( ! $espresso_premium ) { return; } $x = $_GET['promo']; if( !isset($x) ) { $x = ''; } if ( in_array($use_coupon_code,array("Y", "G", "A")) ) { $multi_reg_adjust = $multi_reg ? "[$event_id]" : ''; $output =' <p class="event_form_field coupon_code" id="coupon_code-' . $event_id . '"> <label for="coupon_code" class="inline">' . __('Promo Code', 'event_espresso') . ':</label> <input type="text" class="espresso-coupon-code ' . $class . '" name="event_espresso_coupon_code'. $multi_reg_adjust . '" id="coupon_code-' . $event_id . '" value="' . $x . '"> </p>'; } else { $output = ''; } return $output; } Now if you add &promo=promocode to the end of the URL it will grab that code and insert it into the promo field. |
|
Wow thanks. Its works. so… 1. is this file will be affected when new updates is release? is it will be overwritten and i need to re do the steps? |
Hello, This should be added to a site specific plugin: http://ottopress.com/2011/creating-a-site-specific-snippets-plugin/ This will ensure that it is not lost on a software or theme update. — |
|
The support post ‘Pre-populate promo codes in embedded URL’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.