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
/** | |
* Delete ALL WooCommerce tax rates | |
* | |
* Add to your theme functions.php then go to woocommerce -> system status -> tools and there will be a delete all tax rates button http://cld.wthms.co/tXvp | |
*/ | |
add_filter( 'woocommerce_debug_tools', 'custom_woocommerce_debug_tools' ); | |
function custom_woocommerce_debug_tools( $tools ) { | |
$tools['woocommerce_delete_tax_rates'] = 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 a fixed surcharge to your cart / checkout based on delivery country | |
* Taxes, shipping costs and order subtotal are all included in the surcharge amount | |
* | |
* Change $fixed to set the surcharge to a value to suit | |
* | |
* Add countries to array('US','CA'); to include more countries to surcharge | |
* http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes for available alpha-2 country codes | |
* | |
* Change in_array to !in_array to EXCLUDE the $countries array from surcharges |
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
/** | |
* Move WooCommerce Related Products to a tab | |
* | |
* Copy code to theme functions.php | |
*/ | |
// Remove standard Related Products section | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); | |
/** |
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 and show only free shipping if they are there | |
* | |
* Free Shipping method must be enabled | |
* | |
* Free Shipping will be hidden if specified products are not found | |
* | |
* Add the code to your theme functions.php file | |
*/ | |
add_filter( 'woocommerce_available_shipping_methods', 'free_shipping_when_product_in_cart' , 10, 1 ); |
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
/** | |
* Sort WooCommerce shipping methods by cost, lowest to highest | |
*/ | |
add_filter( 'woocommerce_available_shipping_methods' , 'sort_woocommerce_available_shipping_methods' ); | |
function sort_woocommerce_available_shipping_methods( $available_methods ) { | |
if ( !$available_methods ) return; | |
$tmp = Array(); | |
foreach( $available_methods as $ma ) { |
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
function change_subscription_status( $profile_id, $new_status ) { | |
switch( $new_status ) { | |
case 'Cancel' : | |
$new_status_string = __( 'cancelled', WC_Subscriptions::$text_domain ); | |
break; | |
case 'Suspend' : | |
$new_status_string = __( 'suspended', WC_Subscriptions::$text_domain ); | |
break; | |
case 'Reactivate' : |
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 a 1% surcharge to your cart / checkout based on delivery country | |
* Taxes, shipping costs and order subtotal are all included in the surcharge amount | |
* | |
* Change $percentage to set the surcharge to a value to suit | |
* | |
* Add countries to array('US'); to include more countries to surcharge | |
* http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes for available alpha-2 country codes | |
* | |
* Change in_array to !in_array to EXCLUDE the $countries array from surcharges |
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
/** | |
* Hide ALL shipping options when free shipping is available and customer is NOT in certain states | |
* Hide Free Shipping if customer IS in those states | |
* | |
* UPDATED FOR WOOCOMMERCE 2.1 | |
* | |
* Change $excluded_states = array( 'AK','HI','GU','PR' ); to include all the states that DO NOT have free shipping | |
*/ | |
add_filter( 'woocommerce_package_rates', 'hide_all_shipping_when_free_is_available' , 10, 2 ); |
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
/** | |
* Modifying Headers | |
* | |
* Add to your theme functions.php | |
*/ | |
add_filter( 'pdf_template_table_headings','custom_pdf_template_table_headings' ); | |
function custom_pdf_template_table_headings( $headers ) { | |
$headers = '<table class="shop_table orderdetails" width="100%">' . | |
'<thead>' . | |
'<tr><th colspan="7" align="left"><h2>' . esc_html__('Order Details', PDFLANGUAGE) . '</h2></th></tr>' . |
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
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<style> | |
@page { | |
margin: 480px 50px 150px 50px; | |
} | |
#header { | |
position: fixed; | |
left: 0px; |