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', 'xa_hide_shipping_methods_if_free_flaterate_exist', 10, 2); | |
if(!function_exists('xa_hide_shipping_methods_if_free_flaterate_exist')){ | |
function xa_hide_shipping_methods_if_free_flaterate_exist( $available_shipping_methods, $package ){ | |
$hide_if_shpping_method_exist = array('free_shipping','flat_rate'); //If the shipping methods given here is exists. | |
$method_to_hide = array('wf_australia_post'); //Hide all the shipping method provided here. | |
$do_hide = false; | |
foreach ($hide_if_shpping_method_exist as $method) { |
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_add_charge_if_exceed_cost', 15, 2 ); | |
function wf_add_charge_if_exceed_cost( $available_shipping_methods, $package ){ | |
$mothods = array('wf_woocommerce_shipping_pro'); //Set methods to adjust | |
//Config this array with country code, state code and rate to be added. | |
$destination_array = array( | |
'US' => array( | |
'NY' => 5, | |
'CA' => 6, |
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_custom_tracking_message', 'update_tracking_message', 10, 3); | |
function update_tracking_message($current_msg, $language, $order){ | |
$wpml_language = get_post_meta( $order, 'wpml_language', true); | |
if( $wpml_language == 'fr-ca' ){ | |
return "Votre commande a été expédiée le [DATE] via [SERVICE]. Pour suivre les envois, veuillez suivre le lien correspondant aux numéros d'expédition [ID]"; | |
}else{ | |
return "Your order was shipped on [DATE] via [SERVICE]. To track shipment, please follow the link(s) [ID]"; |
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_request', 'adjust_package_weight', 20, 2); | |
function adjust_package_weight( $rate_request_data, $package ){ | |
$package_extra_weight = 5; | |
$req_arr = explode('<?xml version="1.0" ?>', $rate_request_data); | |
$xml_obj = new SimpleXMLElement( $req_arr[2] ); | |
foreach ($xml_obj->Shipment->Package as $key => $package) { | |
$package->PackageWeight->Weight += $package_extra_weight; | |
} |
NewerOlder