This file contains hidden or 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
| // Place the following code in your theme's functions.php file to add the shipping method to ALL emails | |
| add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_method_to_emails', 15, 2 ); | |
| function wc_add_shipping_method_to_emails( $order, $is_admin_email ) { | |
| echo '<p><strong>Shipping Method:</strong> ' . $order->get_shipping_method() . '</p>'; | |
| } | |
| // Place the following code in your theme's functions.php file to add the shipping method to ADMIN emails only | |
| add_action( 'woocommerce_email_after_order_table', 'wc_add_shipping_method_to_admin_emails', 15, 2 ); |
This file contains hidden or 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_pip_document_table_headers', 'sv_wc_pip_document_unset_sku', 200, 1 ); | |
| add_filter( 'wc_pip_document_table_row_item_data', 'sv_wc_pip_document_unset_sku', 200, 1 ); | |
| function sv_wc_pip_document_unset_sku( $row ) { | |
| unset( $row['sku'] ); | |
| return $row; | |
| } |
This file contains hidden or 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_woocommerce_continue_shopping_redirect( $return_to ) { | |
| return get_permalink( wc_get_page_id( 'shop' ) ); | |
| } | |
| add_filter( 'woocommerce_continue_shopping_redirect', 'my_woocommerce_continue_shopping_redirect', 20 ); |
This file contains hidden or 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
| /** | |
| * This function loops over cart items, and moves any item with shipping class 'special-class' into a new package. | |
| * The new package in this example only takes flat rate shipping. | |
| */ | |
| function split_special_shipping_class_items( $packages ) { | |
| $found_item = false; | |
| $special_class = 'special-class'; // edit this with the slug of your shippig class | |
| $new_package = current( $packages ); | |
| $new_package['contents'] = array(); | |
| $new_package['contents_cost'] = 0; |
This file contains hidden or 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 hide_shipping_when_free_is_available( $rates, $package ) { | |
| $new_rates = array(); | |
| foreach ( $rates as $rate_id => $rate ) { | |
| // Only modify rates if free_shipping is present. | |
| if ( 'free_shipping' === $rate->method_id ) { | |
| $new_rates[ $rate_id ] = $rate; | |
| break; | |
| } | |
| } |
This file contains hidden or 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_login_redirect', 'wc_login_redirect', 10, 2 ); | |
| function wc_login_redirect( $redirect_to, $user ) { | |
| $role = $user->roles[0]; | |
| $myaccount = get_permalink( wc_get_page_id( 'myaccount' ) ); | |
| if( $role == 'customer' ) { | |
| $redirect_to = home_url(); | |
| } | |
| return $redirect_to; | |
| } |
This file contains hidden or 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_product_enable_dimensions_display', '__return_false' ); |
This file contains hidden or 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_ajax_variation_threshold', 'wc_ninja_ajax_threshold' ); | |
| function wc_ninja_ajax_threshold() { | |
| return 50; | |
| } |
This file contains hidden or 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_pip_invoice_email_order_status_change_trigger_actions', 'woo_custom_invoice_status', 10, 2 ); | |
| function woo_custom_invoice_status( $actions, $email_class ) { | |
| $actions = array( | |
| 'woocommerce_order_status_failed_to_completed_notification', | |
| 'woocommerce_order_status_pending_to_completed_notification', | |
| 'woocommerce_order_status_processing_to_completed', | |
| ); | |
| return $actions; | |
| } |