Skip to content

Instantly share code, notes, and snippets.

View rajeshsingh520's full-sized avatar

Rajesh rajeshsingh520

View GitHub Profile
<?php
/*
Add the below code in your active theme functions.php file
This integrate Order date time plugin details in the woocommerce pdf invoice plugin
https://woocommerce.com/products/shipstation-integration/
based on documentation proviced https://docs.woocommerce.com/document/pdf-invoice-developer-tools/#section-10
Do this in PDF invoice tempalte:
To show the detail you need to add '[[DELIVERY_DETAIL]]' in there pdf invocie template file
<?php
add_filter('pisol_rm_remove_add_to_cart_button','pisol_rm_removeAddToCart');
function pisol_rm_removeAddToCart($val){
if(defined("\Zhours\ACTIVE") && constant("\Zhours\ACTIVE")){
if(\Zhours\get_current_status()){
return false;
}else{
return true;
}
<?php
/*
say $order_id has the order or then you can get the detail using the below code
if you have WC_order object in say $order varaible you can get order id like this
$order_id = $order->get_id()
*/
$type = get_post_meta( $order_id, 'pi_delivery_type', true ); // delivery type 'delivery' or 'pickup'
@rajeshsingh520
rajeshsingh520 / disable-free-shipping-bar-for-specific-page.php
Created June 4, 2020 03:14
disable free shipping bar for specifi page using the page id
<?php
add_filter('pi_fsnw_control_filter', 'disableFreeShippingBarForPages');
function disableFreeShippingBarForPages($json){
$disable_for_page = array(124,125); // put in the page id for which you want to disable it
if(is_page($disable_for_page)){
return false;
}
return $json;
@rajeshsingh520
rajeshsingh520 / pickup-now-delivery-now-asap.php
Last active November 17, 2020 01:25
Show time slot of pikcup now or deliver now or asap
add_filter('pisol_dtt_time_slot_filter', 'addingAsap',10,2);
add_filter('pisol_dtt_time_range_filter', 'addingAsap',10,2);
function addingAsap($slot, $date){
$today = current_time('Y/m/d');
if($today === $date && !empty($slot)){
$type = pi_dtt_delivery_type::getType();
if($type === 'delivery'){
$msg = 'Deliver now';
}else{
@rajeshsingh520
rajeshsingh520 / date-time-location-in-order-not.php
Last active March 23, 2021 11:50
add order date time detail in order note
add_action( 'woocommerce_checkout_update_order_meta', 'pisol_kbaab_add_note_for_delivery', 100, 1 );
function pisol_kbaab_add_note_for_delivery( $order_id ) {
$order = wc_get_order($order_id);
$type = get_post_meta( $order_id, 'pi_delivery_type', true ); // delivery type 'delivery' or 'pickup'
$date = get_post_meta( $order_id, 'pi_system_delivery_date', true ); // date in yyyy/mm/dd format
if(class_exists('pi_dtt_date')){
@rajeshsingh520
rajeshsingh520 / custom-css-to-woo-email-template.php
Last active June 9, 2020 03:24
adding custom css to the woocommerce email template
<?php
add_filter( 'woocommerce_email_styles', 'piweb_add_css_to_emails', 9999, 2 );
function piweb_add_css_to_emails( $css, $email ) {
$css .= '
.pi-order-meta-date { font-weight:bold; color:#f00; }
.pi-order-meta-time { font-weight:bold; color:#f00; }
';
return $css;
@rajeshsingh520
rajeshsingh520 / enquiry-cart-10-ditig-validtion.php
Created June 10, 2020 09:44
10 digit phone number calidation for the enquiry cart plugin
<?php
add_action('wp_enqueue_scripts','restrictPhoneNumber');
function restrictPhoneNumber(){
$js = '
jQuery(document).ready(function($){
jQuery("input[name=\'pi_phone\']").attr("data-rule-minlength","10");
jQuery("input[name=\'pi_phone\']").attr("data-rule-maxlength","10");
jQuery("input[name=\'pi_phone\']").attr("data-msg-minlength","Phone number should be of 10 digits");
@rajeshsingh520
rajeshsingh520 / bootstrap-datepicker-conflict.js
Last active June 11, 2020 10:22
disable bootstrap date picker by adding the below code just below the bootstrap date picker library
/**
https://stackoverflow.com/questions/22277563/jquery-ui-datepicker-conflict-with-bootstrap-datepicker
load this just after the bootstrap datepicker without jquery(document).ready();
*/
jQuery.fn.datepicker.noConflict();
@rajeshsingh520
rajeshsingh520 / woo-shipping-method-cache-buster.php
Last active January 27, 2021 06:32
disable woocommerce shipping method cache
<?php
/**
this will clear woocommerce shipping method cache on cart and checkout page
*/
add_filter('wp_loaded', 'clear_wc_shipping_rates_cache');
function clear_wc_shipping_rates_cache(){
if(!isset(WC()->cart)) return;