Skip to content

Instantly share code, notes, and snippets.

@tommyshellberg
Created August 8, 2014 07:55
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save tommyshellberg/098483cd3767bc2f9d66 to your computer and use it in GitHub Desktop.
Save tommyshellberg/098483cd3767bc2f9d66 to your computer and use it in GitHub Desktop.
Change the Woocommerce Bookings display price to an amount per person
//Place in your theme's functions.php file
function custom_booking_price( $price, $product ) {
$target_product_types = array(
'booking'
);
if ( in_array ( $product->product_type, $target_product_types ) ) {
// if variable product change price output
$price = '';
$price .= woocommerce_price($product->get_price()) . ' per person';
return $price;
}
// return normal price
return $price;
}
add_filter('woocommerce_get_price_html', 'custom_booking_price', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment