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_action('wp_head', 'loc_add_googleanalytics'); | |
| function loc_add_googleanalytics() { ?> | |
| <!-- Global site tag (gtag.js) - Google Analytics --> | |
| <script async src="https://www.googletagmanager.com/gtag/js?id=UA-111111111-1"></script> | |
| <script> | |
| window.dataLayer = window.dataLayer || []; | |
| function gtag(){dataLayer.push(arguments);} | |
| gtag('js', new Date()); | |
| gtag('config', 'UA-111111111-1'); |
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_get_order_item_totals', 'loc_remove_cart_subtotal' ); | |
| function loc_remove_cart_subtotal( $totals ) { | |
| unset($totals['cart_subtotal'] ); | |
| return $totals; | |
| } |
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 loc_excerpt_length( $length ) { | |
| return 25; | |
| } | |
| add_filter( 'excerpt_length', 'loc_excerpt_length', 999 ); |
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 loc_update_notice() { | |
| remove_action( 'admin_notices', 'update_nag', 3 ); | |
| } | |
| add_action( 'admin_notices', 'loc_update_notice', 1 ); | |
| // remove to all but admins -> | |
| function loc_update_notice_admin() { | |
| get_currentuserinfo(); |
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_hide_shipping_when_free_is_available( $rates ) { | |
| $free = array(); | |
| foreach ( $rates as $rate_id => $rate ) { | |
| if ( 'free_shipping' === $rate->method_id ) { | |
| $free[ $rate_id ] = $rate; | |
| break; } } | |
| return ! empty( $free ) ? $free : $rates; } | |
| add_filter( 'woocommerce_package_rates', 'my_hide_shipping_when_free_is_available', 100 ); |
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_loop_add_to_cart_link', 'loc_quantity_inputs_for_woo_add_to_cart_link', 10, 2 ); | |
| function loc_quantity_inputs_for_woo_add_to_cart_link( $html, $product ) | |
| { | |
| if ( $product && $product->is_type( 'simple' ) && $product->is_purchasable() && $product->is_in_stock() && ! $product->is_sold_individually() ) | |
| { | |
| $html = '<form action="' . esc_url( $product->add_to_cart_url() ) . '" class="cart" method="post" enctype="multipart/form-data">'; | |
| $html .= woocommerce_quantity_input( array(), $product, false ); | |
| $html .= '<button type="submit" class="button alt">' . esc_html( $product->add_to_cart_text() ) . '</button>'; | |
| $html .= '</form>'; | |
| } |
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 loc_cart_save() { | |
| $savings = 0; | |
| foreach ( WC()->cart->get_cart() as $key => $cart_item ) { | |
| $product = $cart_item['data']; | |
| if ( $product->is_on_sale() ) { | |
| $savings += ( $product->get_regular_price() - $product->get_sale_price() ) * $cart_item['quantity']; | |
| } | |
| } | |
| if ( ! empty( $savings ) ) { | |
| ?><tr class="order-savings"> |
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 loc_woo_hide_coupon_on_cart_page( $enabled ) { | |
| if ( is_cart() ) { | |
| $enabled = false; | |
| } | |
| return $enabled; | |
| } | |
| add_filter( 'woocommerce_coupons_enabled', 'loc_woo_hide_coupon_on_cart_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
| add_filter( 'woocommerce_product_tabs', 'loc_rename_woo_product_tabs', 98 ); | |
| function loc_rename_woo_product_tabs( $tabs ) { | |
| $tabs['description']['title'] = 'Product Description'; | |
| $tabs['reviews']['title'] = 'Ratings & Reviews'; | |
| $tabs['additional_information']['title'] = 'Customer Information'; | |
| return $tabs; | |
| } |