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( 'wc_anti_fraud_rules', 'wc_remove_antifraud_rules'); | |
function wc_remove_antifraud_rules( $rules ) { | |
foreach ( $rules as $key => $rule ) { | |
if ( 'international_order' === $rule->get_id() ) { | |
unset( $rules[$key] ); | |
} | |
} | |
return $rules; |
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( 'wc_anti_fraud_rules', 'wc_remove_antifraud_rules'); | |
function wc_remove_antifraud_rules( $rules ) { | |
foreach ( $rules as $key => $rule ) { | |
if ( 'billing_matches_shipping' === $rule->get_id() ) { | |
unset( $rules[$key] ); | |
} | |
} |
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_checkout_fields' , 'custom_override_checkout_fields' ); | |
function custom_override_checkout_fields( $fields ) { | |
$fields['order']['order_comments']['required'] = true; | |
return $fields; | |
} |
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 unset_my_account_navigation_tabs( $items ) { | |
unset( $items['downloads'] ); | |
// unset more items here | |
return $items; | |
} | |
add_filter( 'woocommerce_account_menu_items', 'unset_my_account_navigation_tabs' ); |
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_instagram_columns', 'woocommerce_instagram_img_columns' ); | |
function woocommerce_instagram_img_columns(){ | |
return 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
function free_label_trs ( $label, $method ) { | |
if ( 0 == $method->cost && 'table_rate' == $method->method_id ) { | |
$label .= ' (' . __( 'Free', 'woocommerce-table-rate-shipping' ) . ')'; | |
} | |
return $label; | |
} | |
add_filter( 'woocommerce_cart_shipping_method_full_label', 'free_label_trs', 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
function my_custom_add_to_cart_redirect( $url ) { | |
$url = WC()->cart->get_checkout_url(); | |
// $url = wc_get_checkout_url(); // since WC 2.5.0 | |
return $url; | |
} | |
add_filter( 'woocommerce_add_to_cart_redirect', 'my_custom_add_to_cart_redirect' ); |
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_admin_stock_html', 'tmt_show_variation_stock_level', 10, 2 ); | |
function tmt_show_variation_stock_level( $stock_html, $the_product ) { | |
if( sizeof( $the_product->get_children() ) ) { | |
$stock_html .= ' (' . $the_product->get_total_stock() . ')'; | |
} |
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 column headers | |
function wc_csv_export_modify_column_headers( $column_headers ) { | |
$new_headers = array( | |
'column_1' => 'VAT Number', | |
// add other column headers here in the format column_key => Column Name | |
); | |
return array_merge( $column_headers, $new_headers ); | |
} |
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' , 'sort_woocommerce_available_shipping_methods_by_cost', 10, 2 ); | |
function sort_woocommerce_available_shipping_methods_by_cost( $rates, $package ) { | |
if ( ! $rates ) { | |
return; | |
} | |
$tmp = array(); | |
foreach( $rates as $rate ) { | |
$tmp[] = $rate->cost; | |
} |