-
-
Save lukecav/a2c3e466afc98048fa3d7e7e182e5f0e to your computer and use it in GitHub Desktop.
Change the WooCommerce Bookings display price to an amount per person
This file contains hidden or 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
| 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