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
add_filter('wf_ups_shipment_confirm_request_data', 'alter_shipment_request1', 10, 3); | |
function alter_shipment_request1($data, $order){ | |
if(!empty($order->customer_message)){ | |
$data['Shipment']['Description'] = $order->customer_message; | |
} | |
return $data; | |
} |
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
add_filter('woocommerce_package_rates', 'hide_shipping_method_when_shipping_class_product_is_in_cart', 10, 2); | |
function hide_shipping_method_when_shipping_class_product_is_in_cart($available_shipping_methods, $package) | |
{ | |
// Shipping class Slugs that need the method removed | |
$shipping_classes = array( | |
'perishable', | |
); |
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
add_filter('wf_dhl_paket_create_shipment_request', 'wf_dhl_paket_modify_shipment_request', 10, 2); | |
function wf_dhl_paket_modify_shipment_request($request, $order){ | |
$street_parts = explode(" ",$order->shipping_address_1); | |
$request['ShipmentOrder']['Shipment']['Receiver']['Address']['streetName'] = current($street_parts); | |
$request['ShipmentOrder']['Shipment']['Receiver']['Address']['streetNumber']= end($street_parts); | |
$request['ShipmentOrder']['Shipment']['Receiver']['Address']['addressAddition']= $order->shipping_address_2; | |
return $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
add_filter('woocommerce_package_rates', 'wf_group_rates', 10, 2); | |
function wf_group_rates($rates, $package){ | |
$groups = array( | |
array( | |
'group_name'=> 'Mail Express', | |
'ids' => array('wf_shipping_usps:D_EXPRESS_MAIL','wf_shipping_usps:flat_rate_box_express'), | |
'operator' => 'min', | |
), | |
array( |
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
add_filter('wf_fedex_request','wf_fedex_label_request_reff_callback', 10, 2 ); | |
function wf_fedex_label_request_reff_callback($request,$order){ | |
$po_number = 'x'; //give Purchase Order here | |
$inv_number = 'x'; // Give Invoice number here | |
$customs_duties_payer = 'SENDER'; // Give $customs duties payer here | |
$reff = array(); | |
if( !empty($po_number) && $po_number!='x' ) | |
$reff['CustomerReferences'][] = array( 'CustomerReferenceType' => 'P_O_NUMBER', 'Value' => $po_number ); |
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
add_filter('woocommerce_package_rates', 'show_flat_rate_for_specified_class_id', 10, 2); | |
function show_flat_rate_for_specified_class_id($available_shipping_methods, $package) | |
{ | |
$exceptional_states = array( | |
'CA', | |
'AZ', | |
'NV', | |
'NM' | |
); |
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
add_filter( 'woocommerce_cart_shipping_packages', 'wf_split_cart_by_shipping_class_group' ); | |
function wf_split_cart_by_shipping_class_group($packages){ | |
//Reset packages | |
$packages = array(); | |
//Init splitted package | |
$splitted_packages = array(); | |
// Group of shipping class ids | |
$class_groups = array( |
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
add_filter('wf_fedex_request','wf_fedex_label_request_callback', 10, 2 ); | |
function wf_fedex_label_request_callback($request,$order){ | |
$custom_products = array( | |
'Product-1' => array( //Replace Product-1 with your product name | |
'Description' => 'sample descrition for product-1', //Enter prodct description here or keep it blank | |
'Amount' => 150.5 //Enter new amount of produt here or keep it blank | |
), | |
'product2' => array( | |
'Description' => 'sample descrition for product-2', |
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
add_filter('wf_fedex_request','wf_fedex_tin_number', 10, 2 ); | |
function wf_fedex_tin_number($request,$order){ | |
$tintype = "BUSINESS_STATE"; | |
$tin_number ="123456"; //replace tin number here | |
if(!empty($tin_number)){ | |
$request['RequestedShipment']['Shipper']['Tins'] = array( | |
'TinType' => $tintype, | |
'Number' => $tin_number | |
); |
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
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; | |
} |
NewerOlder