Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save JarrydLong/a3df6680782920a15dd8b0852efed73f to your computer and use it in GitHub Desktop.

Select an option

Save JarrydLong/a3df6680782920a15dd8b0852efed73f to your computer and use it in GitHub Desktop.
<?php //do not copy
/**
* Adds the number of seats to the bottom of the confirmation page near the totals
*
* You can add this recipe to your site by creating a custom plugin
* or using the Code Snippets plugin available for free in the WordPress repository.
* Read this companion article for step-by-step directions on either method.
* https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*
*/
function my_pmpro_add_seats_to_end_of_price( $pmpro_price_parts, $pmpro_invoice ) {
if( ! class_exists( 'PMProGroupAcct_Group' ) ) {
return $pmpro_price_parts;
}
$existing_group = PMProGroupAcct_Group::get_group_by_parent_user_id_and_parent_level_id( get_current_user_id(), $pmpro_invoice->membership_id );
$pmpro_price_parts['seats']['label'] = 'Number of Seats Purchased';
$pmpro_price_parts['seats']['value'] = $existing_group ? $existing_group->group_total_seats : '-';
return $pmpro_price_parts;
}
add_filter( 'pmpro_get_price_parts', 'my_pmpro_add_seats_to_end_of_price', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment