Skip to content

Instantly share code, notes, and snippets.

View kartikparmar's full-sized avatar

Kartik Parmar kartikparmar

  • Mumbai
View GitHub Profile
@kartikparmar
kartikparmar / functions.php
Created December 27, 2023 10:57
Adding fees, delivery and address information to view bookings page, csv, print
<?php
/* Adding Column on View Bookings */
function bkap_view_booking_columns( $columns ) {
$additional_columns = array( 'bkap_invoice' => __( 'Invoice', 'woocommerce-booking' ), 'bkap_delivery' => __( 'Delivery', 'woocommerce-booking' ), 'bkap_customer_address' => __( 'Customer 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 );
@kartikparmar
kartikparmar / functions.php
Last active December 14, 2023 11:43
dequeue jquery script
<?php
function dequeue_jquery_scripts() {
wp_dequeue_script( 'jquery' );
wp_dequeue_script( 'jquery-ui' );
wp_dequeue_script( 'jquery-ui-datepicker' );
}
add_action( 'wp_enqueue_scripts', 'dequeue_jquery_scripts', 100 );
@kartikparmar
kartikparmar / functions.php
Created November 15, 2023 14:07
add additional text after price
<?php
add_filter( 'bkap_final_price_json_data', 'custom_changes', 10, 3 );
function custom_changes( $wp_send_json, $product_id, $price ) {
$wp_send_json['bkap_price'] = $wp_send_json['bkap_price'] . ' ' . __( '20% off for selected period', 'woocommerce-booking' );
return $wp_send_json;
}
@kartikparmar
kartikparmar / functions.php
Created November 9, 2023 07:28
Adding custom information in the cart item
<?php
/* Adding the custom infromation in the cart item */
function add_custom_info_to_cart_item( $cart_item_meta, $product_id ) {
$cart_item_meta['custom_information'] = 'This is my <strong>custom</strong> information.<br> Please contact support for more information';
return $cart_item_meta;
}
add_filter( 'woocommerce_add_cart_item_data', 'add_custom_info_to_cart_item', 25, 2 );
@kartikparmar
kartikparmar / zoom-oauth-demo.php
Created September 22, 2023 07:49
Connect to Zoom
<?php
/**
* Plugin Name: Zoom OAuth Demo
* Plugin URI: http://www.tychesoftwares.com/
* Description: This plugin is for showing the demo for Zoom Connection via OAuth.
* Version: 1.0
* Author: Tyche Softwares
* Author URI: http://www.tychesoftwares.com/
* Text Domain: zoom-oauth-remo
* Domain Path: /i18n/languages/
@kartikparmar
kartikparmar / functions.php
Last active July 14, 2023 12:28
Vendor confirmed booking
<?php
function vendor_init_emails( $email ) {
if ( ! isset( $emails['RSA_Email_Booking_Confirmed_Vendor'] ) ) {
$emails['RSA_Email_Booking_Confirmed_Vendor'] = include_once BKAP_PLUGIN_PATH . '/emails/vendor-booking-confirmed.php'; // this will be the patch where your file is located.
}
return $emails;
}
add_filter( 'woocommerce_email_classes', 'vendor_init_emails', 10, 1 );
<?php
function bkap_show_hide_persons_based_on_date( $data ) {
$persons_to_hide = array(
'84217' => array( // 84217 is product id
array(
'dates' => '2023-06-25,2023-06-22', // in Y-m-d format.
'person_ids' => array( 84226, 84227 ), // 84226, 84227 are persons ids to hide
),
array(
@kartikparmar
kartikparmar / Wp-vue.php
Last active May 5, 2023 14:37
This file is to create wp plugin using vue
<?php
/**
* Plugin Name: Vue Settings Page Plugin
* Description: A WordPress plugin that adds a settings page with two tabs using Vue.js.
* Version: 1.0.0
@kartikparmar
kartikparmar / functions.php
Created March 28, 2023 17:53
Changing the product price in the renewal order.
<?php
add_filter( 'wcs_renewal_order_created', 'test_change_renewal_order_price', 10, 2 );
function test_change_renewal_order_price( $renewal_order, $subscription ) {
// Get the line item for the subscription product
$line_items = $renewal_order->get_items();
foreach( $line_items as $line_item ) {
@kartikparmar
kartikparmar / response
Created December 20, 2022 10:15
response for time availability information
[
[
{
"date": "2022-12-27",
"start_time": "10:00",
"end_time": "12:00",
"availability": 10
}
{
"date": "2022-12-27",