This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Snippet to hide specified shipping methods with zero cost. | |
| * Created at : 07 Nov 2018 | |
| * Updated at : 07 Nov 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| * Gist Link : https://gist.github.com/varun-pluginhive/a7b88d265b5ecb89d823ffe9d06daf7c | |
| */ | |
| add_filter( 'woocommerce_package_rates', function( $shipping_rates ){ | |
| $shipping_methods = array( 'wf_woocommerce_shipping_pro:1shipping-pro-1'); // Array of Shipping method ids |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Snippet to get Shipping method of third party plugin (Flexible Shipping) from Order. | |
| * Created at : 02 Nov 2018 | |
| * Updated at : 02 Nov 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| * Gist Link : https://gist.github.com/varun-pluginhive/eb754c8b478c901d8cc45b7d226dc93f | |
| */ | |
| add_filter( 'ph_estimated_delivery_selected_shipping_method_on_order', 'ph_retreive_shipping_method_id', 10, 2 ); | |
| if( ! function_exists('ph_retreive_shipping_method_id') ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Snippet to add number of days to the estimated delivery if it falls on specified day. | |
| * Created at : 02 Nov 2018 | |
| * Updated at : 02 Nov 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| * Gist Link : https://gist.github.com/varun-pluginhive/19a921ce09be7b017d7b5819c2896cdf | |
| */ | |
| add_filter( 'xa_estimated_delivery_cart_checkout_page_html_formatted_date', 'xa_modify_cart_page_text', 10, 2 ); | |
| function xa_modify_cart_page_text( $text, $test ) { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Mark Person as Booking For given product Id. | |
| * Created at : 24th Oct 2018 | |
| * Updated at : 24th Oct 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| */ | |
| if( ! function_exists('ph_bookings_get_assets_availability') ) { | |
| function ph_bookings_get_assets_availability( $asset_availability, $asset_id, $booking_count, $max_quantity, $from, $to ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Snippet to hide all other shipping methods when specific shipping method is available. | |
| * Created at : 17 Oct 2018 | |
| * Updated at : 17 Oct 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| * Gist Link : https://gist.github.com/varun-pluginhive/fc7ebbf35377eefae41112893cf5455b | |
| */ | |
| add_filter( 'woocommerce_package_rates', function( $shipping_costs ){ | |
| $if_available = array( 'free_shipping' ); // If available then hide the below shipping methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Snippet to replace character and convert charset while creating label. | |
| * Created at : 11 Oct 2018 | |
| * Updated at : 11 Oct 2018 | |
| * PluginHive Plugins : https://www.pluginhive.com/plugins/ | |
| * Gist Link : | |
| */ | |
| add_filter('wf_ups_shipment_confirm_request', function( $request ) { | |
| $request = str_replace( array('ę', 'Ę', 'ó', 'Ó', 'ą', 'Ą', 'ś', 'Ś', 'ł', 'Ł', 'ż', 'Ż', 'ź', 'Ź', 'ć', 'Ć', 'ń', 'Ń','ś', 'Ś'), array('e', 'E', 'o', 'O', 'a', 'A', 's', 'S', 'l', 'L', 'z', 'Z', 'z', 'Z', 'c', 'C', 'n', 'N','s', 'S'), $request); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Snippet to convert Woocommerce Shipping Currency . | |
| * 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/8e2082c2d1ee9a08ecf48e649b6efd1e | |
| */ | |
| add_filter('woocommerce_package_rates','xa_convert_canada_post_shipping_cost' ); | |
| if( ! function_exists('xa_convert_canada_post_shipping_cost') ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * 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 ) { |