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 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",
@kartikparmar
kartikparmar / product
Created December 19, 2022 12:43
product
{
"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",
@kartikparmar
kartikparmar / functions.php
Last active December 10, 2022 05:08
Dave Changes - Ticket 46398
<?php
function custom_change_cart_meta( $cart ) {
if ( is_admin() && ! defined( 'DOING_AJAX' ) )
return;
if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 )
return;