Skip to content

Instantly share code, notes, and snippets.

@LMNTL
Created June 19, 2019 20:30
Show Gist options
  • Save LMNTL/1488c5e3926dec1ea37276238e746dc8 to your computer and use it in GitHub Desktop.
Save LMNTL/1488c5e3926dec1ea37276238e746dc8 to your computer and use it in GitHub Desktop.
Don't include specific Register Helper checkout box/boxes on the checkout page for members
// don't include specific Register Helper checkout box/boxes on the checkout page for members
function my_pmprorh_remove_box_for_members(){
if( pmpro_hasMembershipLevel() )
{
global $pmprorh_checkout_boxes;
// change this line to include the name of the checkout box(es) to remove
$boxes_to_remove = array("more_fields");
$new_boxes = [];
$count = 0;
foreach($pmprorh_checkout_boxes as $key => $value )
{
if( !in_array( $pmprorh_checkout_boxes[$key]->name, $boxes_to_remove ) )
{
$new_boxes[] = $pmprorh_checkout_boxes[$key];
$new_boxes[$count]->order = $count;
$count++;
}
}
$pmprorh_checkout_boxes = $new_boxes;
}
}
add_action('pmpro_checkout_preheader', 'my_pmprorh_remove_box_for_members');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment