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.
This will ensure that it is not lost on a software or theme update.
—
Lorenzo
Viewing 3 reply threads
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.
Support forum for Event Espresso 3 and Event Espresso 4.