Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
@rajeshsingh520
rajeshsingh520 / disable-order-limit.php
Last active June 16, 2020 09:26
Disable Order limit to speed up the site
<?php
/** This will disable order limit by day, time slot this will increase your speed a lot */
add_filter("pisol_disable_order_limit_check", '__return_true');
@rajeshsingh520
rajeshsingh520 / retain-form-value-on-checkout-page.php
Last active May 17, 2020 10:25
This code cleard the date value when you are using the plugin https://wordpress.org/plugins/woo-save-abandoned-carts/ so retained sate is not maintained for date
<?php
/*
Make sure auto selection of date and time is disabled
https://wordpress.org/plugins/woo-save-abandoned-carts/
*/
add_action('wp_enqueue_scripts', 'pisol_clearValue');
function pisol_clearValue(){
 if(is_checkout()){
 $js = 'jQuery(function ($) {
            setTimeout(\'jQuery("#pi_delivery_date").val("")\',100);
<?php
/** different preparaton time for delivery/pickup */
/* making preparation days as zero */
add_filter('pisol_dtt_setting_filter_pi_order_preparation_days',function($val){ return 0; });
add_filter('pisol_dtt_setting_filter_pi_order_preparation_hours','pisolDifferentPrep');
function pisolDifferentPrep($value){
$type = pi_dtt_delivery_type::getType();
if($type == "delivery"){
@rajeshsingh520
rajeshsingh520 / hide-delivery-type-based-on-cart-total.php
Last active May 23, 2020 03:25
restrict delivery option based on the amount purchased by the customer
<?php
add_filter('pisol_dtt_setting_filter_pi_type','deliveryTypeBasedOnCartTotal');
function deliveryTypeBasedOnCartTotal($type){
$min_amount = 50; // change this amount as per your minimum requirement for delvieru
if(function_exists('WC') && isset(WC()->cart)){
$total = (float)WC()->cart->subtotal;
if($total < $min_amount){
$type = 'Pickup';
}else{
@rajeshsingh520
rajeshsingh520 / remove-slots-as-soon-as-time-start.php
Last active May 17, 2020 10:24
Remove a time slot as soon as the time slot start time is reached
<?php
/* This code remove the time slot as soon as the time slot starts */
add_filter('pisol_dtt_custom_remove_time_slots', 'pisolStopWhenStartSlotReached',100,2);
function pisolStopWhenStartSlotReached($slots, $date){
$current_date = current_time('Y/m/d');
$current_time = current_time("H:i");
if($date == $current_date){
@rajeshsingh520
rajeshsingh520 / conflict-free-bootstrap.css
Last active May 10, 2020 11:52
This is conflict free Bootstrap 4 it will only work inside a <div class="bootstrap-wrapper"></div> container
/**
* All of the CSS for your admin-specific functionality should be
* included in this file.
*/
/*!
* Bootstrap Grid Only (grid and responsive utilities extracted from Bootstrap 4.1.3)
* GitHub: https://github.com/dmhendricks/bootstrap-grid-css
* Bootstrap License: MIT (https://github.com/twbs/bootstrap/blob/v4-dev/LICENSE)
* Credits: Twitter, Inc. & The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
*/
@rajeshsingh520
rajeshsingh520 / product-preparation-time-extended-for-more-then-24hr.php
Last active September 6, 2020 02:12
product preparation time extended for more then 24 hr
<?php
/*
Plugin Name: Making 24hr time comparing for order date and time
*/
add_filter('pisol_dtt_time_slot_filter','pisol_small_addon_timeTo24Hour',10, 2);
add_filter('pisol_dtt_time_range_filter','pisol_small_addon_timeTo24Hour',10, 2);
function pisol_small_addon_timeTo24Hour($times, $date){
$current = current_time('Y/m/d H:i');
@rajeshsingh520
rajeshsingh520 / disable-ajax-loading-of-location.php
Last active May 17, 2020 10:23
disbale ajax loading of location, do this only if you are not restricting pickup location by zone
<?php
add_filter('pisol_disable_ajax_location',function($val){ return true; });
@rajeshsingh520
rajeshsingh520 / different-preparation-time.php
Last active May 17, 2020 10:23
set different preparation time for delivery and pickup
<?php
add_filter('pisol_dtt_setting_filter_pi_order_preparation_days',function($val){ return 0; });
add_filter('pisol_dtt_setting_filter_pi_order_preparation_hours','pisolDifferentPrep');
function pisolDifferentPrep($value){
$type = pi_dtt_delivery_type::getType();
if($type == "delivery"){
return 180;
}else{
return 60;
}
@rajeshsingh520
rajeshsingh520 / disable-date-time-plugin-for-range-of-product.php
Last active March 27, 2021 00:36
disable date and time plugin for some specific range of products
class pisol_marp_disable_dtt_plugin_options{
function __construct(){
add_filter('pisol_disable_dtt_completely', array($this, 'disableDateTimePlugin'));
}
function disableDateTimePlugin($value){
if(is_admin()) return;
$disable_for_product = array(660, 665, 685); // product ids for which date and time plugin will be disabled
if(isset(WC()->cart)){