// hide coupon form everywhere function hide_coupon_field( $enabled ) { if ( is_cart() || is_checkout() ) { $enabled = false; } return $enabled; } add_filter( 'woocommerce_coupons_enabled', 'hide_coupon_field' );
Change the ‘add to cart’ text in WooCommerce
add_filter( 'woocommerce_product_add_to_cart_text', 'custom_add_to_cart_text' ); // category (archives) add_filter( 'woocommerce_product_single_add_to_cart_text', 'custom_add_to_cart_text' ); // single function custom_add_to_cart_text() { return 'My add to cart text'; }
Automatically complete orders in WooCommerce
/** * Auto Complete all WooCommerce orders. * Add to theme functions.php file */ add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' ); function custom_woocommerce_auto_complete_order( $order_id ) { global $woocommerce; if ( !$order_id ) return; $order = new WC_Order( $order_id ); $order->update_status( 'completed' ); }
Re-order the product tabs in WooCommerce
add_filter( 'woocommerce_product_tabs', 'reorder_woocommerce_product_tabs', 98 ); function reorder_woocommerce_product_tabs( $tabs ) { $tabs['reviews']['priority'] = 5; // Reviews first $tabs['description']['priority'] = 10; // Description second $tabs['additional_information']['priority'] = 15; // Additional information third return $tabs; }
Hide excerpts for all WordPress posts
add_filter( 'the_excerpt', 'custom_excerpt' ); function custom_excerpt() { return ''; }