'; echo do_shortcode( '[woocommerce_messages]' ); echo ''; } } } // Set the number of columns to 3 function kad_woocommerce_cross_sells_columns( $columns ) { return 3; } add_filter( 'woocommerce_cross_sells_columns', 'kad_woocommerce_cross_sells_columns', 10, 1 ); // Limit the number of cross sells displayed to a maximum of 3 function kad_woocommerce_cross_sells_total( $limit ) { return 3; } add_filter( 'woocommerce_cross_sells_total', 'kad_woocommerce_cross_sells_total', 10, 1 ); // Redefine woocommerce_output_related_products() function kadence_woo_related_products_limit() { global $product, $woocommerce; $related = $product->get_related(); $args = array( 'post_type' => 'product', 'no_found_rows' => 1, 'posts_per_page' => 4, 'ignore_sticky_posts' => 1, //'orderby' => $orderby, 'post__in' => $related, 'post__not_in' => array($product->id) ); return $args; } add_filter( 'woocommerce_related_products_args', 'kadence_woo_related_products_limit' ); // Number of products per page add_filter('loop_shop_per_page', 'kadence_wooframework_products_per_page'); if (!function_exists('kadence_wooframework_products_per_page')) { function kadence_wooframework_products_per_page() { global $virtue; if ( isset( $virtue['products_per_page'] ) ) { return $virtue['products_per_page']; } } } // Display product tabs? add_action('wp_head','kadence_wooframework_tab_check'); if ( ! function_exists( 'kadence_wooframework_tab_check' ) ) { function kadence_wooframework_tab_check() { global $virtue; if ( isset( $virtue[ 'product_tabs' ] ) && $virtue[ 'product_tabs' ] == "0" ) { remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10); } } } // Display related products? add_action('wp_head','kadence_wooframework_related_products'); if ( ! function_exists( 'kadence_wooframework_related_products' ) ) { function kadence_wooframework_related_products() { global $virtue; if ( isset( $virtue[ 'related_products' ] ) && $virtue[ 'related_products' ] == "0" ) { remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_related_products', 20); } } } add_filter('add_to_cart_fragments', 'kadence_woocommerce_header_add_to_cart_fragment'); function kadence_woocommerce_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> - cart->tax_display_cart == 'incl' ) { echo WC()->cart->get_cart_subtotal(); } else { echo WC()->cart->get_cart_total(); } ?> '.get_the_title().''; } remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation', 10 ); remove_action( 'woocommerce_single_variation', 'woocommerce_single_variation_add_to_cart_button', 20 ); add_action( 'woocommerce_single_variation', 'kt_woocommerce_single_variation', 10 ); add_action( 'woocommerce_single_variation', 'kt_woocommerce_single_variation_add_to_cart_button', 20 ); if ( ! function_exists( 'kt_woocommerce_single_variation_add_to_cart_button' ) ) { /** * Output the add to cart button for variations. */ function kt_woocommerce_single_variation_add_to_cart_button() { global $product; ?>
'; } } // Shop Page Image remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 ); add_action( 'woocommerce_before_shop_loop_item_title', 'kt_woocommerce_template_loop_product_thumbnail', 10 ); function kt_woocommerce_template_loop_product_thumbnail() { global $virtue, $woocommerce_loop, $post; // Store column count for displaying the grid if ( empty( $woocommerce_loop['columns'] ) ) $woocommerce_loop['columns'] = apply_filters( 'loop_shop_columns', 4 ); if ($woocommerce_loop['columns'] == '3'){ $productimgwidth = 365; $productimgheight = 365; } else { $productimgwidth = 268; $productimgheight = 268; } if(isset($virtue['product_img_resize']) && $virtue['product_img_resize'] == 0) { $resizeimage = 0; } else { $resizeimage = 1; } if($resizeimage == 1) { if ( has_post_thumbnail() ) { $image_id = get_post_thumbnail_id( $post->ID ); $product_image_array = wp_get_attachment_image_src( $image_id, 'full' ); $product_image_url = $product_image_array[0]; // Make sure there is a copped image to output $image_product = aq_resize($product_image_url, $productimgwidth, $productimgwidth, true); if(empty($image_product)) {$image_product = $product_image_url;} // Get srcset $img_srcset_output = kt_get_srcset_output( $productimgwidth, $productimgheight, $product_image_url, $image_id); // Get alt and fall back to title if no alt $alt_text = get_post_meta($image_id, '_wp_attachment_image_alt', true); if(empty($alt_text)) {$alt_text = get_the_title();} ob_start(); ?> class="attachment-shop_catalog size- wp-post-image" alt=""> ID, $image_id, array($productimgwidth, $productimgheight), $attr = ''); } elseif ( woocommerce_placeholder_img_src() ) { echo woocommerce_placeholder_img( 'shop_catalog' ); } } else { echo '