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
| /** | |
| * woocommerce_package_rates is a 2.1+ hook | |
| */ | |
| add_filter( 'woocommerce_package_rates', 'hide_shipping_when_free_is_available', 10, 2 ); | |
| /** | |
| * Hide shipping rates when free shipping is available | |
| * | |
| * @param array $rates Array of rates found for the package | |
| * @param array $package The package array/object being shipped |
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
| /** | |
| * Rename a country | |
| */ | |
| add_filter( 'woocommerce_countries', 'rename_ireland' ); | |
| function rename_ireland( $countries ) { | |
| $countries['IE'] = 'Ireland'; | |
| return $countries; | |
| } |
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
| /** | |
| * Change number of upsells output | |
| */ | |
| add_filter( 'woocommerce_upsell_display_args', 'wc_change_number_related_products', 20 ); | |
| function wc_change_number_related_products( $args ) { | |
| $args['posts_per_page'] = 1; | |
| $args['columns'] = 4; //change number of upsells here | |
| return $args; |
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
| /** | |
| * Hide shipping rates when free shipping is available, but keep "Local pickup" | |
| * Updated to support WooCommerce 2.6 Shipping Zones | |
| */ | |
| 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 ) { |
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 the field to the checkout | |
| */ | |
| add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); | |
| function my_custom_checkout_field( $checkout ) { | |
| echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>'; | |
| woocommerce_form_field( 'my_field_name', array( |
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_checkout_fields', 'custom_move_checkout_fields' ); | |
| function custom_move_checkout_fields( $fields ) { | |
| // Lets display the email first. You can move these around depending on your needs. | |
| $billing_order = array( | |
| "billing_email", | |
| "billing_first_name", | |
| "billing_last_name", | |
| "billing_company", |
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
| <?php | |
| /** | |
| * Tab Title filters do not work with WooCommerce 1.6.5.1 or lower | |
| * Please download this zip file http://cl.ly/2Y3S3D3M3C23 , extract the 3 files and copy them to : | |
| * wp-content/themes/YOUR_THEME/woocommerce/single-product/tabs/ | |
| **/ | |
| add_filter ( 'woocommerce_product_description_tab_title', 'custom_product_description_tab_title' ) ; | |
| function custom_product_description_tab_title() { |
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_checkout_fields' , 'custom_remove_woo_checkout_fields' ); | |
| function custom_remove_woo_checkout_fields( $fields ) { | |
| // remove billing fields | |
| unset($fields['billing']['billing_first_name']); | |
| unset($fields['billing']['billing_last_name']); | |
| unset($fields['billing']['billing_company']); | |
| unset($fields['billing']['billing_address_1']); | |
| unset($fields['billing']['billing_address_2']); |