This file contains 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 define a custom date format to show Estimated Delivery Date | |
* Created at : 16 Aug 2021 | |
* PluginHive Plugins : Estimated Delivery Date Plugin For WooCommerce | |
* Gist Link : https://gist.github.com/PluginHive/7fb8f48c6b6f1d30d33ad50cb1a37c2b | |
**/ | |
add_filter( 'xa_change_estimated_delivery_date_format', 'ph_change_estimated_delivery_date_format' ); | |
if( ! function_exists('ph_change_estimated_delivery_date_format') ) { |
This file contains 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 switch UPS Account Based on Shipping Class | |
* Created at : 16 December 2020 | |
* PluginHive Plugins : Switch UPS Account Based on Shipping Class | |
* Gist Link : https://gist.github.com/PluginHive/a7cf9e022e34dc71c5f678d3bf7cb147 | |
**/ | |
add_filter( 'wf_ups_shipment_settings', 'ph_ups_modify_settings_datas', 10, 2 ); | |
function ph_ups_modify_settings_datas( $settings, $order ) { |
This file contains 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
add_filter('woocommerce_package_rates', 'wf_hide_shipping_method_if_accesspoint', 10, 2); | |
function wf_hide_shipping_method_if_accesspoint( $available_shipping_methods, $package ){ | |
global $woocommerce; | |
$shipping_accesspoint = WC()->customer->__get('shipping_accesspoint'); | |
if( !empty($shipping_accesspoint) ){ | |
$decoded_accesspoint = json_decode($shipping_accesspoint); | |
if(isset($decoded_accesspoint->AddressKeyFormat)){ | |
if( !empty( $decoded_accesspoint->AddressKeyFormat->AddressLine ) ){ |
This file contains 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
add_filter('wf_shipping_skip_product','skip_my_products',10,3); | |
function skip_my_products($skip = false, $product, $package){ | |
$shipping_free_classes = array(16); // array of shipping class ids to exclude from cart | |
$shipping_class = $product['data']->get_shipping_class_id(); | |
if(in_array($shipping_class, $shipping_free_classes)){ | |
$skip = true; | |
} |
This file contains 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
add_filter('wf_ups_rate', 'wf_modify_ups_rate', 10, 2); | |
function wf_modify_ups_rate($xml, $packages){ | |
//Config this array with box dimensions and rate to be added. | |
$extra_coast = array( | |
'7,9,8' => 10, | |
'10,6,8' => 15, | |
); | |
if($xml){ | |
foreach ($extra_coast as $extra_coast_dim => $amount_to_add) { |
This file contains 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
// BEGIN export PluginHive WooCommerce UPS Shipping plugin tracking code. */ | |
add_filter('hf_alter_csv_header', 'hf_csv_order_add_more_columns', 10, 1); | |
function hf_csv_order_add_more_columns($csv_columns) { | |
$csv_columns['ups_created_shipments_details_array'] = 'UPS Tracking Number'; | |
return $csv_columns; | |
} | |
add_filter('hf_alter_csv_order_data', 'hf_csv_order_add_more_data', 10, 1); | |
function hf_csv_order_add_more_data($order_data) { |
This file contains 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
define("PV_ATTRIBUTE", "vendor"); | |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly | |
/** | |
* Check if WooCommerce is active | |
*/ | |
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
if ( ! class_exists( 'TH_Shipping_Options' ) ) { | |
class TH_Shipping_Options { | |
/** |
This file contains 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
add_filter('woocommerce_package_rates', 'hide_shipping_method_if_particular_product_available_in_cart', 10, 2); | |
function hide_shipping_method_if_particular_product_available_in_cart($available_shipping_methods) | |
{ | |
global $woocommerce; | |
// products_array should be filled with all the products ids | |
// for which shipping method (stamps) to be restricted. | |
$products_array = array( |
This file contains 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
add_filter('wf_fedex_request','my_call_back', 10, 2 ); | |
function my_call_back($request,$order){ | |
$phone = !empty($order->shipping_phone) ? $order->shipping_phone : $order->billing_phone; | |
$request['RequestedShipment']['Recipient']['Contact']['PhoneNumber'] = $phone; | |
return $request; | |
} |
This file contains 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
add_filter('phive_booking_booked_price_details','phive_booking_booked_price_details',11,3); | |
function phive_booking_booked_price_details($price_details,$product_id,$post_details) | |
{ | |
$custom_messages="This is a recurrent booking. Your upcoming bookings are : "; | |
$new_message = "This class series meets at the green date above, and:"; | |
if(isset($price_details['custom_messages']) ) | |
{ | |
$price_details['custom_messages'] = str_replace($custom_messages, $new_message, $price_details['custom_messages']); |
NewerOlder