Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide the membership pricing box on Sitewide Sales Landing Page checkout form and replace with our own.
<?php
/**
* Hide the membership pricing box on Landing Page checkout form and replace with our own.
*
* Requires Paid Memberships Pro and Sitewide Sales.
*
*/
function maybe_add_choose_level_section_swsales( $include_pricing_fields ) {
global $wpdb, $pmpro_level;
// Make sure Sitewide Sales is active.
if ( ! class_exists( 'Sitewide_Sales\classes\SWSales_Settings' ) ) {
return $include_pricing_fields;
}
// Hide the default pricing box.
if ( Sitewide_Sales\classes\SWSales_Settings::is_active_sitewide_sale_landing_page() ) {
$include_pricing_fields = false;
}
// Show our own radio select and info.
?>
<div id="pmpro_levels_select" class="pmpro_checkout">
<h3><span class="pmpro_checkout-h3-name">Select a Level</span></h3>
<div class="pmpro_checkout-fields">
<div style="cursor: pointer;" onclick="jQuery('#levelradio1').prop('checked', true);">
<p>
<input id="levelradio1" type="radio" name="level" value="1" <?php checked( $pmpro_level->id, 1); ?> />
<strong>Level 1 Name:</strong> <strike class="muted">$97</strike> $47<br />
About the level 1 membership.
</p>
</div>
<div style="cursor: pointer;" onclick="jQuery('#levelradio2').prop('checked', true);">
<p>
<input id="levelradio2" type="radio" name="level" value="2" <?php checked( $pmpro_level->id, 2); ?> />
<strong>Level 2 Name:</strong> <strike class="muted">$197</strike> $97<br />
About the level 2 membership.
</p>
</div>
</div>
</div>
<?php
return $include_pricing_fields;
}
add_filter( 'pmpro_include_pricing_fields', 'maybe_add_choose_level_section_swsales' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.