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
/** | |
* Will change the minutes it takes an In Cart booking to expire. | |
* This example reduces the number from 60 to 30. | |
* | |
* @param int $minutes 60 is the default passed | |
* @return int The amount of minutes you'd like to have In Cart bookings expire on. | |
*/ | |
function change_incart_bookings_expiry_minutes_20170825( $minutes ) { | |
return 30; | |
} |
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
/*Options Total*/ | |
.product-addon-totals dt:nth-child(1) { color:red;} | |
/*Options Total Sum*/ | |
.product-addon-totals dd:nth-child(2) { color:red;} | |
/*Grand Total*/ | |
.product-addon-totals dt:nth-child(3) { color:blue;} | |
/*Grand Total Sum*/ |
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
// Set default value to 0 for Custom price input | |
jQuery(document).ready(function(){ | |
jQuery('.wc-pao-addon-custom-price').val("0"); | |
}); |
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
/** | |
* Will enable big selects when the host has a low threshold for MAX_JOIN_SIZE. | |
* This is sometimes the case with shared hosting. | |
*/ | |
function enable_big_selects_for_bookings_20170825() { | |
global $wpdb; | |
$wpdb->query( 'SET SQL_BIG_SELECTS=1' ); | |
} | |
add_action( 'init', 'enable_big_selects_for_bookings_20170825' ); |
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
/** | |
* Will put bookings into a Confirmed status if they were paid for via COD. | |
* | |
* @param int $order_id The order id | |
*/ | |
function set_cod_bookings_confirmed_20170825( $order_id ) { | |
// Get the order, then make sure its payment method is COD. | |
$order = wc_get_order( $order_id ); | |
if ( 'cod' !== $order->get_payment_method() ) { |
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
function custom_adjust_datepicker_range () { | |
if ( is_checkout() ) { | |
wp_enqueue_script( 'jquery' ); | |
?> | |
<script type="text/javascript"> | |
jQuery( document ).ready( function ( e ) { | |
if ( jQuery( '.checkout-date-picker' ).length ) { | |
jQuery( '.checkout-date-picker' ).datepicker( 'option', 'changeYear', true ); | |
jQuery( '.checkout-date-picker' ).datepicker( 'option', 'yearRange', '-40:+0' ); | |
} |
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
/** | |
* Will make it so the Dependencies tab shows on a Bookable product. | |
* | |
* @param array $tabs The list of tabs in a product's settings. | |
*/ | |
function add_bookable_product_to_dependencies( $tabs ) { | |
// Check to see if the class exists and if the tab is set. | |
if ( class_exists( 'WC_Product_Dependencies' ) && isset( $tabs['dependencies'] ) ) { | |
// If so, add our class for the JS hooks. | |
$tabs['dependencies']['class'][] = 'show_if_booking'; |
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
function custom_override_checkout_fields ( $fields ) { | |
$fields['billing']['test_radio']['default'] = 'one'; | |
return $fields; | |
} // End custom_override_checkout_fields() | |
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); |
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
/** | |
* Will make it so that the date format when the calendar is not used is DD/MM/YYYY on a Bookable product. | |
*/ | |
add_filter( 'woocommerce_bookings_mdy_format' , '__return_false' ); |
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
/* WooCommerce - extends woocommerce checkout field editor */ | |
/* adds additional display areas (Admin edit user screen and WooCommerce WebHooks */ | |
/** | |
* add custom checkout fields to user profile on admin edit screen | |
* | |
* @param mixed $payload | |
*/ | |
function filter_woocommerce_admin_profile__custom_checkout_fields( $payload ) { | |
if ( class_exists( 'WC_Checkout_Field_Editor' ) ) { | |
$fieldgroups = array( 'billing'=>'billing', 'shipping'=>'shipping', 'additional'=>'additional' ); |