Created
May 13, 2015 20:08
-
-
Save WillBrubaker/d76f025f82aec6186863 to your computer and use it in GitHub Desktop.
Template override to remove WooCommerce Bookings resource cost indicator from dropdown select
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
<?php | |
extract( $field ); | |
<p class="form-field form-field-wide <?php echo implode( ' ', $class ); ?>"> | |
<label for="<?php echo $name; ?>"><?php echo $label; ?>:</label> | |
<select name="<?php echo $name; ?>" id="<?php echo $name; ?>"> | |
<?php foreach ( $options as $key => $value ) : ?> | |
<?php | |
/* | |
The default file just echos out the value | |
this will modify that behaviour to match a pattern and replace that pattern with an empty string | |
it is echoed out below via preg_replace | |
*/ | |
$pattern = '#\(\+<span class="amount">.*\)#'; | |
$replacement = ''; | |
?> | |
<option value="<?php echo $key; ?>"><?php echo preg_replace( $pattern, $replacement, $value ); ?></option> | |
<?php endforeach; ?> | |
</select> | |
</p> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a filter called "woocommerce_bookings_resource_additional_cost_string" that allows to modify the string. Over writing the whole template removes the price from all "other" fields that use the type select. If that is the goal, this is the quickest way to change all outputs no matter the source (plugin).