Revision: 69916
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 8, 2015 15:38 by julian90
Initial Code
// Ensure cart contents update when products are added to the cart via AJAX, in "$0.00" format
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;
}
// ADD BRAND CUSTOM FIELD TO SINGLE PRODUCT SUMMARY
add_action( 'woocommerce_single_product_summary', 'add_custom_field', 7 );
add_action( 'woocommerce_after_shop_loop_item_title', 'add_custom_field', 40 );
function add_custom_field() {
global $post;
echo "<div class='artist'>";
echo get_post_meta( $post->ID, 'Collaborative Artist', true );
echo "</div>";
return true;
}
// Change root breadcrumb link
add_filter( 'woocommerce_breadcrumb_defaults', 'jk_change_breadcrumb_home_text' );
function jk_change_breadcrumb_home_text( $defaults ) {
// Change the breadcrumb home text from 'Home' to 'Shop'
$defaults['home'] = 'Shop';
return $defaults;
}
add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );
function woo_custom_breadrumb_home_url() {
return '/shop';
}
Initial URL
Initial Description
Various WooCommerce theme customizations. See comments in code.
Initial Title
WooCommerce theme customizations
Initial Tags
Initial Language
PHP