Skip to content

Instantly share code, notes, and snippets.

@PluginHive
Last active October 24, 2019 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PluginHive/af7126481b9bf115369f51a4b64138fa to your computer and use it in GitHub Desktop.
Save PluginHive/af7126481b9bf115369f51a4b64138fa to your computer and use it in GitHub Desktop.
Display total participant as order item quantity in email (If Consider each participant as separate booking is enabled)
function display_total_participant_in_email_order_item_quantity($quantity,$item =array()) {
if(!empty($item) && !empty($item->get_product_id()) ) {
$product_id=$item->get_product_id();
$_persons_as_booking = get_post_meta( $product_id, "_phive_booking_persons_as_booking", 1 );
if($_persons_as_booking=='yes')
{
$no_of_persons=$item->get_meta('Number of persons',true);
if(!empty($no_of_persons))
{
return $no_of_persons;
}
else
{
return '-';
}
}
else
return '-';
}
return $quantity;
}
add_filter( 'woocommerce_email_order_item_quantity', 'display_total_participant_in_email_order_item_quantity',10,2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment