3,
'columns' => 3,
);
$args = wp_parse_args( $defaults, $args );
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'business_commerce_woocommerce_related_products_args' );
/**
* Remove default WooCommerce wrapper.
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
if ( ! function_exists( 'business_commerce_woocommerce_wrapper_before' ) ) {
/**
* Before Content.
*
* Wraps all WooCommerce content in wrappers which match the theme markup.
*
* @return void
*/
function business_commerce_woocommerce_wrapper_before() {
?>
cart->get_cart_contents_count() ); ?>
(.+?)<\/a>/is", do_shortcode( '[add_to_cart id="' . get_the_id() . '"]' ), $output );
}
return $output;
} // business_commerce_custom_excerpt.
endif;
add_filter( 'get_the_excerpt', 'business_commerce_woocommerce_custom_excerpt' );
/**
* Remove items from product loop
* Check woocommerce/content-product.php
*/
function business_commerce_remove_product_loop_content() {
remove_action( 'woocommerce_before_shop_loop_item', 'woocommerce_template_loop_product_link_open', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
remove_action( 'woocommerce_shop_loop_item_title', 'woocommerce_template_loop_product_title', 10 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_rating', 5 );
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_product_link_close', 5 );
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
}
add_action( 'init', 'business_commerce_remove_product_loop_content' );
if ( defined( 'YITH_WCWL' ) && ! function_exists( 'business_commerce_yith_wishlist_ajax_update' ) ) {
/**
* Count number of items in wishlist and send it.
*/
function business_commerce_yith_wishlist_ajax_update() {
wp_send_json( array(
'count' => yith_wcwl_count_all_products(),
) );
}
add_action( 'wp_ajax_business_commerce_yith_wcwl_update_wishlist_count', 'business_commerce_yith_wishlist_ajax_update' );
add_action( 'wp_ajax_nopriv_business_commerce_yith_wcwl_update_wishlist_count', 'business_commerce_yith_wishlist_ajax_update' );
}
if ( defined( 'YITH_WCWL' ) && ! function_exists( 'yith_wcwl_enqueue_custom_script' ) ) {
/**
* Count number of products wishlist in ajax and update count in header.
*/
function business_commerce_yith_wcwl_enqueue_custom_script() {
wp_add_inline_script(
'jquery-yith-wcwl',
"
jQuery( function( $ ) {
$( document ).on( 'added_to_wishlist removed_from_wishlist', function() {
$.get( yith_wcwl_l10n.ajax_url, {
action: 'business_commerce_yith_wcwl_update_wishlist_count'
}, function( data ) {
$('.wishlist-count').html( data.count );
});
});
});
"
);
}
add_action( 'wp_enqueue_scripts', 'business_commerce_yith_wcwl_enqueue_custom_script', 20 );
}
add_action( 'product_cat_add_form_fields', 'business_commerce_add_term_fields', 999999 );
function business_commerce_add_term_fields( $taxonomy ) {
?>
term_id, 'business-commerce-custom-icon', true );
$image_id = get_term_meta( $term->term_id, 'business_commerce_icon_image_id', true );
$image_thumb = wc_placeholder_img_src();
if ( $image_thumb_obj = wp_get_attachment_image_src( $image_id ) ) {
$image_thumb = $image_thumb_obj[0];
}
?>
| ', '' ); ?> |
|
|
|
|
|
|
term_id, 'business-commerce-custom-icon', true );
$image_id = get_term_meta( $cat->term_id, 'business_commerce_icon_image_id', true );
if ( $icon ) {
$output = '' . $output;
} elseif ( $image_id ) {
if ( $image_thumb_obj = wp_get_attachment_image_src( $image_id ) ) {
$image_thumb = $image_thumb_obj[0];
}
$output = '
' . $output;
}
return $output;
}
add_filter( 'list_product_cats', 'business_commerce_add_image_in_cat', 10, 2 );