Skip to content

Instantly share code, notes, and snippets.

View varun-pluginhive's full-sized avatar

varun-pluginhive

View GitHub Profile
@varun-pluginhive
varun-pluginhive / functions.php
Last active September 11, 2018 12:14
Snippet to change Access Point name on checkout field. WOOCOMMERCE UPS SHIPPING PLUGIN WITH PRINT LABEL - https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/
/**
* Snippet to change Access Point name on checkout field.
* Created at : 11 Sep 2018
* Updated at : 11 Sep 2018
* PluginHive Plugins : http://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/b048f5b225f0182211afdbc0c6d15362
*/
if( ! function_exists('ph_customize_access_point_name') ) {
function ph_customize_access_point_name( $fields ){
@varun-pluginhive
varun-pluginhive / functions.php
Last active September 12, 2018 16:47
Snippet to hide all ups rates apart from access point economy. If Access point has been selected. WOOCOMMERCE UPS SHIPPING PLUGIN WITH PRINT LABEL - https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/
/**
* Snippet to hide all ups rates apart from access point economy. If Access point has been selected.
* Created at : 12 Sep 2018
* Updated at : 12 Sep 2018
* PluginHive Plugins : https://www.pluginhive.com/
* Gist Link : https://gist.github.com/varun-pluginhive/0fff2c5a078192748aff1627756b862d
*/
if( ! function_exists('ph_hide_ups_rates_apart_from_access_point_economy') ) {
function ph_hide_ups_rates_apart_from_access_point_economy( $rates ) {
$access_point = WC()->session->get('ph_ups_selected_access_point_details');
@varun-pluginhive
varun-pluginhive / functions.php
Last active September 14, 2018 06:40
Snippet to convert the dimension in FedEx plugin. WOOCOMMERCE FEDEX SHIPPING PLUGIN WITH PRINT LABEL - https://www.pluginhive.com/product/woocommerce-fedex-shipping-plugin-with-print-label/
/**
* Snippet to convert the dimension in FedEx plugin.
* Created at : 14 Sep 2018
* Updated at : 14 Sep 2018
* Xadapter Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/068bb9aa5b54e79973255b571d0ab629
*/
if( ! function_exists('ph_fedex_convert_dimension') ) {
function ph_fedex_convert_dimension( $converted_dimension, $dimension, $to_unit, $from_unit ) {
@varun-pluginhive
varun-pluginhive / functions.php
Created September 14, 2018 07:45
Snippet to map WooCommerce Shipping Method name to another name (Shipping Meta). PluginHive Plugins -https://www.pluginhive.com/
/**
* Snippet to map woocommerce shipping method name to another name.
* Created at : 14 Sep 2018
* Updated at : 14 Sep 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/14fd167b4fb127a6a4b8af2513fc4fae
*/
if( ! function_exists('ph_map_wc_shipping_method_name') ) {
function ph_map_wc_shipping_method_name( $shipping_rates ) {
$shipping_method_name_map_arr = array(
@varun-pluginhive
varun-pluginhive / functions.php
Created September 17, 2018 13:02
Snippet to add WooCommerce shipping Pro rates to UPS and USPS rates. WOOCOMMERCE TABLE RATE SHIPPING PRO PLUGIN - https://www.pluginhive.com/product/woocommerce-table-rate-shipping-pro-plugin/
/**
* Snippet to add WooCommerce shipping Pro rates to UPS and USPS rates.
* Created at : 17 Sep 2018
* Updated at : 17 Sep 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/9005d87294abf046243b3ef816185948
*/
if( ! function_exists('ph_add_shipping_pro_rate_to_up_or_usps_rates') ) {
function ph_add_shipping_pro_rate_to_up_or_usps_rates( $shipping_rates ) {
@varun-pluginhive
varun-pluginhive / functions.php
Created September 17, 2018 14:08
Snippet to change Estimated delivery text based on stock quantity. ESTIMATED DELIVERY DATE PLUGIN FOR WOOCOMMERCE - https://www.pluginhive.com/product/estimated-delivery-date-plugin-woocommerce/
/**
* Snippet to change Estimated delivery text based on stock quantity.
* Created at : 17 Sep 2018
* Updated at : 17 Sep 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/1bdeb6c3b18a126cdae99ab92b451892
*/
if( ! function_exists('change_estimated_delivery_text_on_product_page') ) {
function change_estimated_delivery_text_on_product_page( $stock_arr, $item ) {
@varun-pluginhive
varun-pluginhive / functions.php
Created September 19, 2018 13:41
Snippet to start label generation if status changed to processing from Admin. WOOCOMMERCE UPS SHIPPING PLUGIN WITH PRINT LABEL - https://www.pluginhive.com/product/woocommerce-ups-shipping-plugin-with-print-label/
/**
* Snippet to start label generation if status changed to processing from Admin.
* Created at : 19 Sep 2018
* Updated at : 19 Sep 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/134e7cf7743da10b7fd3fe51121275eb
*/
if( ! function_exists('trigger_ups_label_generation') ) {
function trigger_label_generation_externally( $order_id ) {
@varun-pluginhive
varun-pluginhive / functions.php
Last active September 28, 2018 08:00
Snippet to hide Flat rate if cart amount is more than specified amount else hide Free Shipping. If the product comes with other products add the flat rate to ups and hide other rates. PluginHive Plugins - https://www.pluginhive.com/plugins/
/**
* Snippet to hide Flat rate if cart amount is more than specified amount else hide Free Shipping. If the product comes with other products add the flat rate to ups and hide other rates.
* Created at : 20 Sep 2018
* Updated at : 28 Sep 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/2cea63276a98c1869328c1743993e4ee
*/
if( ! empty('ph_skip_shipping_method_based_on_shipping_class') ) {
function ph_skip_shipping_method_based_on_shipping_class( $shipping_costs, $package ) {
@varun-pluginhive
varun-pluginhive / functions.php
Created October 4, 2018 10:41
Snippet to sort the WooCommerce Shipping Rates in ascending order. PluginHive Plugins : https://www.pluginhive.com/plugins/
/**
* Snippet to sort the WooCommerce Shipping Rates in ascending order.
* Created at : 04 Oct 2018
* Updated at : 04 Oct 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/683bb169341200d59c4d3058d5ca06eb
*/
add_filter( 'woocommerce_package_rates', function( $rates ){
if( empty($rates) ) return $rates;
@varun-pluginhive
varun-pluginhive / functions.php
Last active October 5, 2018 06:09
Snippet to display the Simple Date in Cart, Checkout and Thank you page and Date Range in Product Page. ESTIMATED DELIVERY DATE PLUGIN FOR WOOCOMMERCE - https://www.pluginhive.com/product/estimated-delivery-date-plugin-woocommerce/
/**
* Snippet to display the Simple Date in Cart, Checkout and Thankyou page and Date Range in Product Page.
* Created at : 05 Oct 2018
* Updated at : 05 Oct 2018
* PluginHive Plugins : https://www.pluginhive.com/plugins/
* Gist Link : https://gist.github.com/varun-pluginhive/f8b76ab1d1b1e07b6a7fe26d993f1e4c
*/
// Cart and Checkout Page
add_filter( 'xa_estimated_delivery_cart_checkout_page_html_formatted_date', function($html_date){