Last active
August 29, 2015 14:17
-
-
Save bowatts/5f50ebbc7b6378a57efb to your computer and use it in GitHub Desktop.
inc/woocommerce.php
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_theme_support( 'woocommerce' ); | |
remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20 ); | |
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 ); | |
function wcs_woo_remove_reviews_tab($tabs) { | |
unset($tabs['reviews']); | |
return $tabs; | |
} | |
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10); | |
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10); | |
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10); | |
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10); | |
function my_theme_wrapper_start() { | |
echo '<div id="primary" class="container content-area">'; | |
} | |
function my_theme_wrapper_end() { | |
echo '</div>'; | |
} | |
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php) | |
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' ); | |
function woocommerce_header_add_to_cart_fragment( $fragments ) { | |
ob_start(); | |
?> | |
<a class="cart-contents" href="<?php echo WC()->cart->get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf (_n( '%d item', '%d items', WC()->cart->cart_contents_count ), WC()->cart->cart_contents_count ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a> | |
<?php | |
$fragments['a.cart-contents'] = ob_get_clean(); | |
return $fragments; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment