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
<?php | |
/** | |
* Remove quantity input field in cart for specific products | |
*/ | |
function prefix_cart_item_quantity( $product_quantity, $cart_item_key ){ | |
$cart_item = WC()->cart->cart_contents[ $cart_item_key ]; | |
$product_id = $cart_item['data']->get_id(); | |
if( in_array( $product_id, array( 467, 789 ) ) ){ | |
$product_quantity = $cart_item['quantity']; | |
} |
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
<?php | |
/** | |
* Add div inside group wrapper | |
*/ | |
function prefix_open_group_inner( $group_id, $group, $group_index ) { | |
echo '<div class="my-group-inner">'; | |
} | |
add_action( 'pewc_open_group_inner', 'prefix_open_group_inner', 10, 4 ); | |
function prefix_close_group_inner( $group_id, $group, $group_index ) { |
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
<?php | |
/** | |
* Filter group wrapper classes | |
* @param $classes Array | |
*/ | |
function prefix_filter_group_wrapper_class( $classes, $group_id, $group, $product_id ) { | |
$classes[] = 'my-new-group-class'; | |
return $classes; | |
} | |
add_filter( 'pewc_filter_group_wrapper_class', 'prefix_filter_group_wrapper_class', 10, 4 ); |
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
<?php | |
/** | |
* Open a new div to wrap multiple groups | |
* Ensure you update the group ID | |
*/ | |
function prefix_open_group_wrapper( $group_id, $group, $group_index ) { | |
if( $group_id == 455 ) { | |
echo '<div class="my-group-wrapper">'; | |
} | |
} |
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
<?php | |
/** | |
* Enable text values from calculation lookup tables | |
*/ | |
add_filter( 'pewc_allow_text_calcs', '__return_true' ); |
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
<?php | |
/** | |
* Array of discount rates | |
*/ | |
function prefix_discount_rates( $rates, $product_id ) { | |
$excluded_ids = array( 1234 ); | |
if( in_array( $product_id, $excluded_ids ) ) { | |
return $rates; | |
} | |
$rates = array( |
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
<?php | |
/** | |
* Ensure tax isn't added to options with 'value only' | |
*/ | |
function prefix_check_tax_for_option_price( $check, $option_price, $item ) { | |
if( ! empty( $item['option_price_visibility'] && $item['option_price_visibility'] == 'value' ) ) { | |
return false; | |
} | |
return $check; | |
} |
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
<?php | |
/** | |
* Filter Bookings discount rates | |
*/ | |
function prefix_discount_rates( $rates, $product_id ) { | |
$rates = array( | |
array( | |
'rate' => 3, | |
'after' => 10, | |
'from' => 'all' |
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
/* Disable checkboxes */ | |
.pewc-group-checkbox .pewc-item-field-wrapper { | |
pointer-events: none; | |
} |
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
<?php | |
/** | |
* Display remaining quantity on Bookings page | |
*/ | |
function prefix_display_remaining_quantity() { | |
$remaining = bfwc_get_max_bookings( get_the_ID() ); | |
printf( | |
'Places remaining: %s', | |
$remaining | |
); |
NewerOlder