Skip to content

Instantly share code, notes, and snippets.

@lukecav
Forked from tommyshellberg/functions.php
Last active September 22, 2017 14:51
Show Gist options
  • Select an option

  • Save lukecav/a2c3e466afc98048fa3d7e7e182e5f0e to your computer and use it in GitHub Desktop.

Select an option

Save lukecav/a2c3e466afc98048fa3d7e7e182e5f0e to your computer and use it in GitHub Desktop.
Change the WooCommerce Bookings display price to an amount per person
function WC_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', 'wc_custom_booking_price', 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment