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_restrict_shipping_methods_based_on_state_and_zipcode', 10, 2); | |
function wf_restrict_shipping_methods_based_on_state_and_zipcode($available_shipping_methods, $package){ | |
$destination = $package['destination']; | |
$dest_postcode = $destination['postcode']; | |
$dest_state = $destination['state']; | |
//Config this array with state code, zip code, and services you have to show. | |
$restrict_methods = array( | |
'CA'=> array( | |
//Show only UPS Ground for California have zip code start with 910 |
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', 'remove_fraction_for_switz', 10, 2); | |
function remove_fraction_for_switz($request, $order) { | |
if ($request['RequestedShipment']['Shipper']['Address']['CountryCode'] == 'CH') { | |
$request['RequestedShipment']['TotalWeight']['Value'] = ceil($request['RequestedShipment']['TotalWeight']['Value']); | |
foreach ($request['RequestedShipment']['RequestedPackageLineItems'] as $key => &$value) { | |
if( isset( $value['Dimensions'] ) ){ | |
$value['Dimensions']['Length'] = ceil( $value['Dimensions']['Length'] ); | |
$value['Dimensions']['Width'] = ceil( $value['Dimensions']['Width'] ); | |
$value['Dimensions']['Height'] = ceil( $value['Dimensions']['Height'] ); | |
$value['Weight']['Value'] = ceil( $value['Weight']['Value'] ); |
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_estimate_delivery_date_format', 'change_estimate_delivery_date_format', 15, 2 ); | |
function change_estimate_delivery_date_format($current_formate){ | |
return 'l, F jS Y'; // Give here desired format, This format gives output like Tuesday, September 13th 2017. | |
} |
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
function filter_get_hook_prefix_weight($this_weight, $instance) { | |
if (!$this_weight || $this_weight < 0.6) $this_weight = .6; | |
return $this_weight; | |
} | |
function filter_get_hook_prefix_height($this_height, $instance) { |
NewerOlder