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
/** | |
* Change Your calendar starting date based on your availability rule. | |
* Created at : 27th June 2019 | |
*/ | |
add_filter( 'ph_booking_calendar_start_date', 'ph_booking_calendar_start_date',10, 2 ); | |
function ph_booking_calendar_start_date($start_date,$product_id) | |
{ | |
// return $message; | |
$fixed_availability_from = get_post_meta( $product_id, "_phive_fixed_availability_from", 1 ); |
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
/** | |
* Snippet to rearrange shipping methods in cart page | |
* Created at : 18 July 2019 | |
* PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
* Gist Link : https://gist.github.com/PluginHive/ccc1f3e0251f9056dc911e06edd30c92 | |
**/ | |
add_filter('woocommerce_package_rates', 'ph_sort_shipping_methods', 10, 2); | |
function ph_sort_shipping_methods($available_shipping_methods, $package) |
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
/*font size for week days, dates, time */ | |
.ph-calendar-days li, .ph-calendar-weekdays li{ | |
font-size:15px; | |
} | |
/*font size for month text*/ | |
.ph-calendar-month ul li{ | |
font-size: 15px !important; | |
} | |
.booking-info-wraper { | |
font-size: 15px !important; |
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
add_filter('ph_bookings_calendar_time_slot_value', 'display_cost_below_time', 10, 4); //This filter is used to display cost below the time displayed in time calendar(minutes and hours) | |
function display_cost_below_time($start_time_wp_format, $product_id, $interval, $start_time) | |
{ | |
$currency = get_woocommerce_currency_symbol(); | |
$weekdays_price = 400; //default price for weekdays(Monday to Friday) | |
//change price for weekdays according to time ranges | |
if (strtotime(date('H:i', $start_time)) >= strtotime('8am') && strtotime(date('H:i', $start_time)) <= strtotime('4pm')) //8am to 4pm | |
{ |
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
/* hide non-available dates in time calendar */ | |
#ph-calendar-time li.ph-calendar-date.de-active.not-available { | |
display: none !important; | |
} | |
/* hide booked slots in time calendar */ | |
#ph-calendar-time li.ph-calendar-date.booking-full.de-active { | |
display: 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
//snippet to hide quantity in checkout page for bookable products | |
add_filter( 'woocommerce_checkout_cart_item_quantity', 'woocommerce_checkout_cart_item_quantity_ph',10,3 ); | |
function woocommerce_checkout_cart_item_quantity_ph($quantity_html,$cart_item,$key ) { | |
if(!empty($cart_item) && isset($cart_item['product_id']) && !empty($cart_item['product_id'])) | |
{ | |
$product=wc_get_product($cart_item['product_id']); | |
if(!empty($product) && !empty($product->get_type()) && $product->get_type()=='phive_booking') | |
{ | |
return ""; | |
} |
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 display_total_participant_in_email_order_item_quantity($quantity,$item =array()) { | |
if(!empty($item) && !empty($item->get_product_id()) ) { | |
$product_id=$item->get_product_id(); | |
$_persons_as_booking = get_post_meta( $product_id, "_phive_booking_persons_as_booking", 1 ); | |
if($_persons_as_booking=='yes') | |
{ | |
$no_of_persons=$item->get_meta('Number of persons',true); | |
if(!empty($no_of_persons)) | |
{ | |
return $no_of_persons; |
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 total_participant_in_woocommerce_cart_item_quantity($product_quantity, $cart_item_key, $cart_item) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); | |
if($_product->is_sold_individually()) | |
{ | |
$product_type = $_product->get_type(); | |
if( $product_type == 'phive_booking' ) | |
{ | |
$_persons_as_booking = get_post_meta( $product_id, "_phive_booking_persons_as_booking", 1 ); | |
if($_persons_as_booking=='yes' && array_key_exists('phive_booked_persons', $cart_item) && !empty($cart_item['phive_booked_persons'])) |
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 hide_woocommerce_cart_item_quantity($product_quantity, $cart_item_key, $cart_item) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); | |
if($_product->is_sold_individually()) | |
{ | |
$product_type = $_product->get_type(); | |
if( $product_type == 'phive_booking' ) | |
{ | |
$product_quantity = sprintf( '%s <input type="hidden" name="cart[%s][qty]" value="1" />','', $cart_item_key ); | |
} |
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
//cart page | |
function hide_woocommerce_cart_item_quantity($product_quantity, $cart_item_key, $cart_item) { | |
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key ); | |
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key ); | |
if($_product->is_sold_individually()) | |
{ | |
$product_type = $_product->get_type(); | |
if( $product_type == 'phive_booking' ) | |
{ | |
$product_quantity = sprintf( '%s <input type="hidden" name="cart[%s][qty]" value="1" />','', $cart_item_key ); |
OlderNewer