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 to theme functions.php | |
* Check the System Status | |
*/ | |
add_filter( 'woocommerce_debug_posting' , 'custom_wp_remote_get_test' ); | |
function custom_wp_remote_get_test( $posting ) { | |
// WP Remote Get Check | |
$posting['wp_remote_get']['name'] = __( 'Remote Get', 'woocommerce'); |
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
/** | |
* Check the cart for specific products, remove Free Shipping method if they are present | |
* | |
* Add the code to your theme functions.php file | |
*/ | |
add_filter( 'woocommerce_package_rates', 'unset_free_shipping_method' , 10, 2 ); | |
function unset_free_shipping_method( $rates, $package ) { | |
/** | |
* Setup an array or products |
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('usps_disable_first_class_rate_first-class-mail-parcel', '__return_true'); | |
add_filter('usps_disable_first_class_rate_first-class-mail-large-envelope', '__return_true'); | |
add_filter('usps_disable_first_class_rate_first-class-mail-stamped-letter', '__return_true'); | |
add_filter('usps_disable_first_class_rate_first-class-mail-postcards', '__return_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
/** | |
* Set maximum shipping cost for specific Table Rate shipping methods | |
*/ | |
add_filter( 'woocommerce_package_rates' , 'woocommerce_set_maximum_shipping_cost', 10, 2 ); | |
function woocommerce_set_maximum_shipping_cost( $rates, $package ) { | |
foreach( $rates as $rate ) { | |
/** | |
* Change 10 to your maximum shipping cost and the label to match your Method Title | |
* shown here https://dl.dropboxusercontent.com/s/5q9hfei3hgnbnt9/2014-10-13%20at%2001.25%20%281%29.png?dl=0 |
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
/** | |
* Set maximum shipping cost depending on delivery country in WooCommerce | |
*/ | |
add_filter( 'woocommerce_package_rates' , 'woocommerce_set_maximum_shipping_cost', 10, 2 ); | |
function woocommerce_set_maximum_shipping_cost( $rates, $package ) { | |
/** | |
* Create an array of countries for a maximum shipping cost | |
* eg array('US','CA'); | |
* for US and Canada. |
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
/** | |
* Set maximum shipping cost in WooCommerce | |
*/ | |
add_filter( 'woocommerce_package_rates' , 'woocommerce_set_maximum_shipping_cost', 10, 2 ); | |
function woocommerce_set_maximum_shipping_cost( $rates, $package ) { | |
foreach( $rates as $rate ) { | |
// Change 10 to your maximum shipping cost | |
if( $rate->cost > 10 ) { | |
$rate->cost = 10; |
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
/** | |
* USPS 4.0 introduced the ability for envelopes to be flexible you can disable this with this function | |
* Simply set the type to 'envelope' instead of 'package' for any of the flat rate services that USPS lists as envelopes | |
*/ | |
add_filter( 'usps_flat_rate_boxes', 'custom_usps_flat_rate_boxes' ); | |
function custom_usps_flat_rate_boxes( $flat_rate_boxes ) { | |
// Priority Mail Express Envelopes | |
$flat_rate_boxes["d13"]["type"] = 'envelope'; |
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
/** | |
* Remove USPS Flat rate envelopes from the available options | |
* Once added the customer will not see any rates for envelopes | |
*/ | |
add_filter( 'usps_flat_rate_boxes', 'custom_usps_flat_rate_boxes' ); | |
function custom_usps_flat_rate_boxes( $flat_rate_boxes ) { | |
unset($flat_rate_boxes["d29"]); | |
unset($flat_rate_boxes["d30"]); | |
unset($flat_rate_boxes["d63"]); |
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 custom status to order list | |
*/ | |
add_action( 'init', 'register_custom_post_status', 10 ); | |
function register_custom_post_status() { | |
register_post_status( 'wc-backorder', array( | |
'label' => _x( 'Back Order', 'Order status', 'woocommerce' ), | |
'public' => true, | |
'exclude_from_search' => false, | |
'show_in_admin_all_list' => 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
/** | |
* Round Shipping in the event of PayPal errors | |
*/ | |
add_filter( 'woocommerce_package_rates', 'fix_shipping_rounding_errors' , 10, 2 ); | |
/** | |
* | |
*/ | |
function fix_shipping_rounding_errors( $rates, $package ) { | |