'; echo ''; do_action( 'kernel_before_shop_loop_item' ); echo ''; echo '
'; }, 99 ); /** Update the number on cart icon */ add_filter( 'woocommerce_add_to_cart_fragments', ' kernel_woocommerce_cart_link_fragment' ); if ( ! function_exists( ' kernel_woocommerce_cart_link_fragment' ) ) { /** Ensure cart contents update when products are added to the cart via AJAX. * * @param fragments $fragments for woocommerce. */ function kernel_woocommerce_cart_link_fragment( $fragments ) { global $woocommerce; ob_start(); ?> cart->get_cart_contents_count(), 'kernel' ), WC()->cart->get_cart_contents_count() ); ?> '; } add_filter( 'loop_shop_per_page', 'kernel_products_per_page', 20 ); /** Output the script placement */ function kernel_products_per_page() { if ( ! $items = kernel_get_mod( 'shop_products_per_page' ) ) { return 6; } else { return $items; } } add_filter( 'loop_shop_columns', 'kernel_shop_loop_columns', 20 ); /** Change columns in product loop */ function kernel_shop_loop_columns() { if ( ! $cols = kernel_get_mod( 'shop_columns' ) ) { return 3; } else { if ( '2' === $cols ) { return 2; } if ( '3' === $cols ) { return 3; } if ( '4' === $cols ) { return 4; } } } add_theme_support( 'wc-product-gallery-zoom' ); add_theme_support( 'wc-product-gallery-lightbox' ); add_theme_support( 'wc-product-gallery-slider' ); add_filter( 'woocommerce_output_related_products_args', 'kernel_related_products' ); /** Change columns in related products output to 4 */ function kernel_related_products() { $args = array( 'posts_per_page' => 3, 'columns' => 3, ); return $args; } add_filter( 'woocommerce_product_thumbnails_columns', 'kernel_custom_storefront_gallery' ); /** * Change product thumbnails columns to 6 * * @param column $column for storefront. */ function kernel_custom_storefront_gallery( $column ) { $column = 6; return $column; } /** Add category to product item */ function kernel_product_cat() { $cats = wp_get_post_terms( get_the_ID(), 'product_cat' ); if ( $cats && ! is_wp_error( $cats ) ) { $cat = array_shift( $cats ); ?>