View functions.php
add_filter( 'woocommerce_continue_shopping_redirect', 'custom_continue_shopping_redirect' ); | |
function custom_continue_shopping_redirect( $default ) { | |
// Write your conditional code here | |
return $default; | |
} |
View functions.php
add_filter( 'woocommerce_continue_shopping_redirect', function() { return get_home_url(); } ); |
View functions.php
add_filter( 'woocommerce_get_availability_text', 'price_out_of_stock_string', 10, 2 ); | |
function price_out_of_stock_string( $text, $product ) { | |
if ( $text === 'Out of stock' && $product->get_price() < 100 ) { | |
return "Out of stock because of The Queen's Gambit"; | |
} | |
return $text; | |
} |
View functions.php
// Up-sells sorting | |
add_filter( 'woocommerce_upsells_orderby', function() { return 'date'; } ); | |
add_filter( 'woocommerce_upsells_order', function() { return 'desc'; } ); | |
// Cross-sells sorting | |
add_filter( 'woocommerce_cross_sells_orderby', function() { return 'date'; } ); | |
add_filter( 'woocommerce_cross_sells_order', function() { return 'desc'; } ); |
View functions.php
add_filter( 'woocommerce_table_rate_compare_price_limits_after_discounts', '__return_true' ); |
View functions.php
/** | |
* Remove the "nofollow" attribute from all comments author's links | |
* except for a specific author. | |
*/ | |
function dofollow_blog_author_comment( $return, $author ) { | |
if ( $author === 'Your Name' ) { | |
$return = str_replace( "rel='external nofollow ugc'", '', $return ); | |
} | |
return $return; |
View functions.php
add_filter( 'woocommerce_cart_needs_payment', '__return_false' ); |
View functions.php
add_filter( 'woocommerce_order_barcodes_barcode_string', 'change_barcode_text' ); | |
function change_barcode_text( $barcode_string ) { | |
$barcode_class = WooCommerce_Order_Barcodes::get_instance(); | |
$order_id = barcode_class->get_barcode_order( $barcode_string ); | |
return $order_id; | |
} |
View functions.php
add_filter( 'woocommerce_add_to_cart_validation', 'wc_limit_one_per_order', 10, 2 ); | |
function wc_limit_one_per_order( $passed_validation, $product_id ) { | |
if ( 31 !== $product_id ) { | |
return $passed_validation; | |
} | |
if ( WC()->cart->get_cart_contents_count() >= 1 ) { | |
wc_add_notice( __( 'This product cannot be purchased with other products. Please, empty your cart first and then add it again.', 'woocommerce' ), 'error' ); | |
return false; | |
} |
View functions.php
add_action( 'after_setup_theme', 'remove_portfolio' ); | |
function remove_portfolio() { | |
remove_action( 'init', 'portfolio_register' ); | |
} |
NewerOlder