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
{ | |
"id": 4586, | |
"name": "Date and time", | |
"slug": "date-and-time-4", | |
"permalink": "https://team-sandbox.tychesoftwares.com/kartik/product/date-and-time-4/", | |
"date_created": "2022-12-19T16:29:06", | |
"date_created_gmt": "2022-12-19T10:59:06", | |
"date_modified": "2022-12-19T16:29:07", | |
"date_modified_gmt": "2022-12-19T10:59:07", | |
"type": "simple", |
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 | |
function custom_change_cart_meta( $cart ) { | |
if ( is_admin() && ! defined( 'DOING_AJAX' ) ) | |
return; | |
if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) | |
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
<?php | |
/** | |
* Setting booking fields data from the URL parameters. start and end date is passed in the URL parameters. This can be changed according to business requirements. e.g check_in and check_out. | |
*/ | |
function bkap_set_bookings_via_get() { | |
if ( isset( $_GET['start'] ) && isset( $_GET['end'] ) ) { | |
$start_date = $_GET['start']; |
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 | |
function bkap_booking_status_on_create_order( $status ) { | |
if ( is_admin() ) { | |
if ( isset( $_POST['original_post_status'] ) ) { | |
return $status; | |
} | |
$status = 'pending-confirmation'; | |
} |
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 | |
/** | |
* Global Time Slots Booking for the Durations Based Time. | |
*/ | |
function bkap_additional_bookings_to_be_considered( $booking_idss, $product_id, $resource_id ) { | |
// Getting Product ids that has Duration Based Time Booking Type. | |
$args = array( | |
'post_type' => 'product', |
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
array( | |
'post_type' => 'bkap_booking', | |
'post_status' => array( 'paid', 'pending-confirmation', 'confirmed' ), | |
'posts_per_page' => -1, | |
'meta_query' => array( | |
array( | |
'key' => '_bkap_start', | |
'value' => date( 'YmdHis', strtotime( 'today' ) ), |
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 | |
/** | |
* This will send the Booking Confirmation email to customer even if the product is not setup with the requires confirmation option. | |
* | |
* @param int $order_id Order Id. | |
*/ | |
function bkap_send_booking_confirmation( $order_id ) { | |
if ( ! $order_id ) |
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 | |
/** | |
* Adding custom data to item when booking order is placed. | |
* | |
* @param int $item_id Item ID. | |
* @param int $product_id Product ID. | |
* @param array $booking_data Booking data. | |
*/ | |
function bkap_update_item_meta( $item_id, $product_id, $booking_data ) { |
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_action( 'after_wcfm_products_manage', function( $product_id ) { | |
?> | |
<script type="text/javascript"> | |
jQuery( document ).ready( function( $ ) { | |
function bkap_hide_booking_metabox() { | |
let product_type = $( '#product_type' ).val(); | |
let allowed_type = [ 'simple'/* , 'variable', 'subscription','variable-subscription' */ ]; | |
if ( jQuery.inArray( product_type, allowed_type ) == -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
<?php | |
/* Adding Column on View Bookings */ | |
function bkap_view_booking_columns( $columns ) { | |
$additional_columns = array( 'bkap_customer_email' => __( 'Email Address', 'woocommerce-booking' ) ); | |
// Adding column after Booked by hence 5. | |
$columns = array_slice( $columns, 0, 5, true ) + $additional_columns + array_slice( $columns, 5, count( $columns ) - 5, true ); |