Created
November 5, 2018 14:51
-
-
Save kimcoleman/063ca42c8d8b3ae162fb800260b5e257 to your computer and use it in GitHub Desktop.
Hide the "Membership Level" description and pricing box at Membership Checkout and replace with our own box with radio-selection for multiple level display.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Hide the PMPro pricing box at checkout and replace with our own. | |
* | |
* Requires Paid Memberships Pro v1.9.5.6+ and the Sitewide Sales Add On v1.0+ | |
* | |
* Add this code below to your PMPro Customizations Plugin - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
*/ | |
function maybe_add_choose_level_section( $include_pricing_fields ) { | |
global $wpdb, $pmpro_level; | |
// Make sure Sitewide Sales Add On is active. | |
if( ! class_exists( 'PMPro_Sitewide_Sales\includes\classes\PMPro_SWS_Settings' ) ) { | |
return $include_pricing_fields; | |
} | |
// Hide the default pricing box. | |
if( PMPro_Sitewide_Sales\includes\classes\PMPro_SWS_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);"> | |
<h2> | |
<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 | |
</h2> | |
<p>About the level 1 membership.</p> | |
</div> | |
<div style="cursor: pointer;" onclick="jQuery('#levelradio2').prop('checked', true);"> | |
<h2> | |
<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 | |
</h2> | |
<p>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' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist is not compatible with the Sitewide Sales plugin and will need to be updated to work with that plugin. You can use a modified version of this recipe instead: https://gist.github.com/kimcoleman/0146529d87c2950e43b23c9f4d2dfa71