Skip to content

Instantly share code, notes, and snippets.

@xadapter
xadapter / functions.php
Last active September 19, 2019 06:57
Snippet to hide Multi-Carrier Shipping fallback rates if any other carrier rates are being shown. This will work when fallback rate is based on per unit quantity. Multi-Carrier Shipping Plugin for WooCommerce by PluginHive - https://www.pluginhive.com/product/multiple-carrier-shipping-plugin-woocommerce/
/**
* Snippet to hide multicarrier shipping fallback rates if any other multicarrier rates are being shown. This will work when fallback rate is based on per unit quantity.
* Created at : 03 Aug 2018
* Updated at : 03 Aug 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/ba600aa9fbf72b5409cf64493070c45b
*/
add_filter( 'woocommerce_package_rates', 'ph_hide_mc_fallback_rates', 10, 2 );
if( ! function_exists('ph_hide_mc_fallback_rates') ) {
@xadapter
xadapter / style.css
Created August 3, 2018 05:02
Snippet to override the calendar CSS of woocommerce-booking-and-appointments plugin https://www.pluginhive.com/product/woocommerce-booking-and-appointments/
//Change the color of text "pick Please a booking period" here.
.callender-msg{
color:white;
}
//Change the color of the calendar here.
.ph-calendar-month{
background:red;
}
@xadapter
xadapter / functions.php
Last active September 19, 2019 06:58
Snippet to add Company Logo in top of UPS label in ZPL format. WooCommerce UPS Shipping Plugin with Print Label by PluginHive - https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/
/**
* Snippet to add Company Logo in top of UPS label in zpl format.
* Created at : 01 Aug 2018
* Updated at : 01 Aug 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/90f6b1f63b67fd4ef596b35adc940314
*/
if( ! function_exists('ph_generate_document_file') ) {
function ph_generate_document_file($content, $file_name){
@xadapter
xadapter / functions.php
Last active September 19, 2019 06:59
Snippet to send estimated delivery on top to admin for new order and to customer for processing order status. Estimated Delivery Date Plugin for WooCommerce by PluginHive - https://www.pluginhive.com/product/estimated-delivery-date-plugin-woocommerce/
/**
* Snippet to send estimated delivery on top to admin for new order and to customer for processing order status.
* Created at : 30 July 2018
* Updated at : 30 July 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/9a20d5f173498dd8a68074d4b87dafb1
*/
add_action( 'woocommerce_email_order_details', 'ph_add_estimated_delivery_after_heading', 1, 4 );
@xadapter
xadapter / functions.php
Last active September 19, 2019 07:00
Snippet to update PO Number, Invoice Number and Recipient Tax number using WooCommerce FedEx Shipping Plugin with Print Label - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/**
* Snippet to update PO Number, Invoice Number and Recipient Tax number.
* Created at : 30 July 2018
* Updated at : 06 Aug 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/f471f8266b21d68720c4d4d474e468bd
*/
add_filter('wf_fedex_request','wf_fedex_label_request_reff_callback', 10, 2 );
function wf_fedex_label_request_reff_callback($request,$order){
$po_number = $order->get_meta('customer_po'); // Give Purchase Order here
@xadapter
xadapter / functions.php
Last active September 19, 2019 07:04
Snippet to hide normal shipping methods if any Freight Shipping Class in cart else Hide Freight Shipping methods if any normal WooCommerce Shipping Class product in cart. PluginHive Plugins - https://www.pluginhive.com/product/multiple-carrier-shipping-plugin-woocommerce/, https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-p…
/**
* Snippet to hide normal shipping methods based if any freight shipping class in cart else hide freight shipping method if any normal shipping class product in cart.
* Created at : 27 July 2018
* Updated at : 27 July 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/0504f1442d9c21d7014543bfc7589f78
*/
add_filter( 'woocommerce_package_rates', 'ph_hide_shipping_method_based_on_shipping_class', 10, 2 );
@xadapter
xadapter / functions.php
Last active September 19, 2019 07:15
Snippet to show the notice message on WooCommerce Cart and Checkout if any particular word found in Address line one and two. PluginHive Shipping Plugins supported - https://www.pluginhive.com/product/multiple-carrier-shipping-plugin-woocommerce/, https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/, https://www.p…
/**
* Snippet to show the notice message on Cart and Checkout if any particular word found in Address line one and two.
* Created at : 24 July 2018
* Updated at : 24 July 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link :
*/
add_filter( 'woocommerce_package_rates', 'ph_add_notice_if_po_box_addresses', 10, 2 );
if( ! function_exists('ph_add_notice_if_po_box_addresses') ) {
/**
* Snippet to hide text from Woocommerce stock availability on product page.
* Created at : 23 July 2018
* Updated at : 23 July 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/c16bd38ec7aa11c59b6cd176218b38e2
*/
add_filter( 'woocommerce_get_availability', function( $stock_arr ){
@xadapter
xadapter / functions.php
Last active September 19, 2019 12:30
Snippet to display WooCommerce Shipment Tracking last live status on WooCommerce->Order page. Display only for UPS, USPS and FedEx. WooCommerce Shipment Tracking Pro - https://www.pluginhive.com/product/woocommerce-shipment-tracking-pro/
/**
* Snippet to display last live tracking status on woocommerce->Order page. Display only for UPS, USPS and FedEx.
* Created at : 20 July 2018
* Updated at : 20 July 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/9fa56cff0857bcb71b7bd49d2101cacd
*/
// Add columns to the order list
add_filter( 'manage_edit-shop_order_columns', function($columns) {
@xadapter
xadapter / functions.php
Last active September 19, 2019 12:31
Snippet to update live tracking status from backend for specified number of previous days. PluginHive plugin used - WooCommerce Shipment Tracking Pro - https://www.pluginhive.com/product/woocommerce-shipment-tracking-pro/
/**
* Snippet to update live tracking status from backend for specified number of previous days. To trigger the manual update go to Woocommerce->Orders page and add &update_tracking_manually=yes in url and press enter.
* Created at : 20 July 2018
* Updated at : 20 July 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/xadapter/e86aac0f4e7381c3533373ae7f6edc12
*/
add_action( 'init', 'ph_update_live_tracking_status', 100 );
function ph_update_live_tracking_status() {