Created
August 8, 2014 07:55
-
-
Save tommyshellberg/098483cd3767bc2f9d66 to your computer and use it in GitHub Desktop.
Change the Woocommerce Bookings display price to an amount per person
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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