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 | |
| add_filter( 'woocommerce_available_shipping_methods', 'hide_standard_shipping_when_free_is_available' , 10, 1 ); | |
| function hide_standard_shipping_when_free_is_available( $available_methods ) { | |
| if( isset( $available_methods['free_shipping'] ) ) { | |
| $methods = $available_methods; | |
| foreach( $methods as $key => $method ) { | |
| if ( $key <> 'free_shipping' ) | |
| unset( $available_methods[$key] ); | |
| } | |
| } |
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 | |
| // Place the following code in your theme's functions.php file and replace tax_exempt_role with the name of the role to apply to | |
| add_action( 'init', 'woocommerce_customer_tax_exempt' ); | |
| function woocommerce_customer_tax_exempt() { | |
| global $woocommerce; | |
| if ( is_user_logged_in() ) { | |
| $tax_exempt = current_user_can( 'tax_exempt_role'); | |
| $woocommerce->customer->set_is_vat_exempt( $tax_exempt ); | |
| } | |
| } |
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 | |
| function get_user_role() { | |
| global $current_user; | |
| $user_roles = $current_user->roles; | |
| $user_role = array_shift($user_roles); | |
| return $user_role; | |
| } |
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 | |
| // Page Title, displayed as the title of the browser | |
| add_filter( 'eway_shared_page_tite', 'woocommerce_eway_page_title' ); | |
| function woocommerce_eway_page_title() { | |
| return __( 'My New Page Title', 'woocommerce' ); | |
| } | |
| // Company Name, the name of the company the customer is buying from | |
| add_filter( 'eway_shared_company_name', 'woocommerce_eway_company_name' ); |
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 | |
| add_action( 'woocommerce_before_my_account', 'woocommerce_customer_licenses_my_account' ); | |
| function woocommerce_customer_licenses_my_account() { | |
| global $wpdb; | |
| $current_user = wp_get_current_user(); | |
| $licence_keys = $wpdb->get_results( | |
| $wpdb->prepare( | |
| " | |
| SELECT * FROM {$wpdb->prefix}woocommerce_software_licences | |
| WHERE activation_email = %s |
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 | |
| add_filter( 'manage_edit-shop_order_columns', 'woo_order_weight_column' ); | |
| function woo_order_weight_column( $columns ) { | |
| $columns['total_weight'] = __( 'Weight', 'woocommerce' ); | |
| return $columns; | |
| } | |
| add_action( 'manage_shop_order_posts_custom_column', 'woo_custom_order_weight_column', 2 ); | |
| function woo_custom_order_weight_column( $column ) { | |
| global $post, $woocommerce, $the_order; |
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 | |
| add_action( 'woocommerce_after_shop_loop_item', 'woocoomerce_archive_backorder', 6 ); | |
| function woocoomerce_archive_backorder(){ | |
| global $product; | |
| if ( $product->backorders_require_notification() && $product->is_on_backorder( 1 ) ) | |
| echo '<p class="backorder_notification">' . __( 'Available on backorder', 'woocommerce' ) . '</p>'; | |
| } | |
| ?> |
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 | |
| add_shortcode( 'product_upsells', 'wc_upsells_shortcode' ); | |
| function wc_upsells_shortcode( $atts ) { | |
| extract( shortcode_atts( array( | |
| 'posts_per_page' => '-1', | |
| 'columns' => '2', | |
| 'orderby' => 'rand' | |
| ), $atts ) ); | |
| woocommerce_get_template( 'single-product/up-sells.php', array( | |
| 'posts_per_page' => $posts_per_page, |
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 | |
| add_action( 'woocommerce_before_single_product', 'wc_brand_image_single_product' ); | |
| function wc_brand_image_single_product() { | |
| global $post; | |
| $brands = wp_get_post_terms( $post->ID, 'product_brand' ); | |
| if ( $brands ) | |
| $brand = $brands[0]; | |
| if ( ! empty( $brand ) ) { | |
| $thumbnail = get_brand_thumbnail_url( $brand->term_id ); | |
| $url = get_term_link( $brand->slug, 'product_brand' ); |
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 | |
| add_action( 'wp_enqueue_scripts', 'checkout_lightbox' ); | |
| function checkout_lightbox() { | |
| global $woocommerce; | |
| $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; | |
| if ( is_checkout() ) { | |
| wp_enqueue_script( 'prettyPhoto', $woocommerce->plugin_url() . '/assets/js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array( 'jquery' ), $woocommerce->version, true ); | |
| wp_enqueue_script( 'prettyPhoto-init', $woocommerce->plugin_url() . '/assets/js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery' ), $woocommerce->version, true ); | |
| wp_enqueue_style( 'woocommerce_prettyPhoto_css', $woocommerce->plugin_url() . '/assets/css/prettyPhoto.css' ); | |
| } |