';
}
remove_action('woocommerce_before_shop_loop_item','woocommerce_template_loop_product_link_open',10);
add_action('woocommerce_before_shop_loop_item','bestore_woocommerce_template_loop_product_link_open',40);
}
if ( ! function_exists( 'bestore_woocommerce_template_loop_product_link_close' ) ) {
/**
* Insert the opening anchor tag for products in the loop.
*/
function bestore_woocommerce_template_loop_product_link_close() {
echo '
';
}
remove_action('woocommerce_after_shop_loop_item','woocommerce_template_loop_product_link_close',10);
add_action('woocommerce_after_shop_loop_item','bestore_woocommerce_template_loop_product_link_close',10);
}
if ( ! function_exists( 'bestore_thumbnail_template_loop_add_to_cart' ) ) {
/**
* Get the add to cart template for the loop.
*
* @param array $args Arguments.
*/
function bestore_thumbnail_template_loop_add_to_cart( $args = array() ) {
global $product;
if ( $product ) {
$defaults = array(
'quantity' => 1,
'class' => implode( ' ', array_filter( array(
'button ',
'product_type_' . $product->get_type(),
$product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '',
$product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '',
) ) ),
'attributes' => array(
'data-product_id' => $product->get_id(),
'data-product_sku' => $product->get_sku(),
'aria-label' => $product->add_to_cart_description(),
'rel' => 'nofollow',
),
);
$args = apply_filters( 'bestore_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product );
wc_get_template( 'loop/add-to-cart-thumbnail.php', $args );
}
}
add_action( 'bestore_loop_add_to_cart', 'bestore_thumbnail_template_loop_add_to_cart', 10 );
}
if ( ! function_exists( 'bestore_woocommerce_template_loop_product_thumbnail' ) ) {
//remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
/**
* Get the product thumbnail for the loop.
*/
function bestore_woocommerce_template_loop_product_thumbnail() {
global $product;
$attachment_ids = $product->get_gallery_image_ids();
$link = apply_filters( 'woocommerce_loop_product_link', get_the_permalink(), $product );
echo '
';
}
remove_action( 'woocommerce_before_shop_loop_item_title','woocommerce_template_loop_product_thumbnail',10 );
add_action( 'woocommerce_before_shop_loop_item_title','bestore_woocommerce_template_loop_product_thumbnail',10 );
}
if ( ! function_exists( 'bestore_template_loop_product_title' ) ) {
/**
* Show the product title in the product loop. By default this is an H2.
*/
function bestore_template_loop_product_title() {
echo '
';
}
}
if ( ! function_exists( 'bestore_template_loop_price' ) ) {
add_action( 'woocommerce_template_loop_price', 'bestore_template_loop_price', 99 );
function bestore_template_loop_price(){
echo '
';
}
}
add_filter( 'woocommerce_upsell_display_args', 'custom_woocommerce_upsell_display_args' );
function custom_woocommerce_upsell_display_args( $args ) {
$args['posts_per_page'] = 6; // Change this number
$args['columns'] = 3; // This is the number shown per row.
return $args;
}
add_filter( 'woocommerce_cross_sells_columns', 'bestore_change_cross_sells_columns' );
function bestore_change_cross_sells_columns( $columns ) {
return 3;
}