get_type();
} else {
$prod_type = $product->product_type;
}
if ( function_exists( 'method_exists' ) && method_exists( $product, 'get_stock_status' ) ) {
$prod_in_stock = $product->get_stock_status();
} else {
$prod_in_stock = $product->is_in_stock();
}
if ( $product ) {
$args = array();
$defaults = array(
'quantity' => 1,
'class' => implode(
' ', array_filter(
array(
'button',
'product_type_' . $prod_type,
$product->is_purchasable() && $prod_in_stock ? 'add_to_cart_button' : '',
$product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : '',
)
)
),
);
$args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product );
wc_get_template( 'inc/woocommerce/add-to-cart.php', $args );
}
}
endif;
/**
* Refresh WooCommerce cart count instantly.
*
* @since bigbang 1.0
*/
function bigbang_woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
cart->cart_contents_count ), 'bigbang' ), absint( $woocommerce->cart->cart_contents_count ) );
echo ' - ';
echo wp_kses(
$woocommerce->cart->get_cart_total(), array(
'span' => array(
'class' => array(),
),
)
);
?>
'content-sidebar-right col-md-9',
'sidebar-left' => 'content-sidebar-left col-md-9',
'full-width' => 'content-full col-md-12',
'is_shop' => true,
);
$class_to_add = bigbang_get_content_classes( $bigbang_page_sidebar_layout, 'sidebar-woocommerce', $args );
?>
ID, 'product_cat' );
$i = false;
if ( ! empty( $product_categories ) ) {
/**
* Show only the first $nb_of_cat words. If the value is modified in bigbang_shop_category_words filter with
* something lower than 0 then it will display all categories.
*/
$categories_length = sizeof( $product_categories );
$nb_of_cat = apply_filters( 'bigbang_shop_category_words', 2 );
$nb_of_cat = intval( $nb_of_cat );
$index = 0;
if ( $nb_of_cat !== 0 ) {
echo '
';
foreach ( $product_categories as $product_category ) {
if ( $index < $nb_of_cat || $nb_of_cat < 0 ) {
$product_cat_id = $product_category->term_id;
$product_cat_name = $product_category->name;
if ( ! empty( $product_cat_id ) && ! empty( $product_cat_name ) ) {
if ( $i ) {
echo ' , ';
}
echo '' . esc_html( $product_cat_name ) . '';
$i = true;
}
$index ++;
}
}
echo '
';
}
}
?>
-1 ? bigbang_limit_content( $title_in_words, $title_limit, ' ' ) : $title;
?>
post_excerpt ) :
/**
* Explode the excerpt in words by ' ' separator and show only the first 60 words. If the value is modified to -1 or lower in
* a function hooked at bigbang_shop_excerpt_words, then use the normal behavior from woocommece ( show post excerpt )
*/
$excerpt_in_words = explode( ' ', $post->post_excerpt );
$excerpt_limit = apply_filters( 'bigbang_shop_excerpt_words', 60 );
$excerpt_limit = intval( $excerpt_limit );
$limited_excerpt = $excerpt_limit > -1 ? bigbang_limit_content( $excerpt_in_words, $excerpt_limit, ' ' ) : $post->post_excerpt;
?>
';
}
/**
* Add after cart totals code for card.
*/
function bigbang_woocommerce_after_cart_totals() {
echo '
';
}
/**
* Add compatibility with WooCommerce Product Images customizer controls.
*
* Because there are no filters in WooCommerce to change the default values of those controls,
* we have to update those controls in order to have the same image size as it was until now.
* This function runs only once to update those controls.
*
* Even if there were filters, woocommerce does update_options in their plugin so if we change
* the defaults it's equal with 0.
*/
function bigbang_woocommerce_product_images_compatibility() {
$execute = get_option( 'bigbang_update_woocommerce_customizer_controls', false );
if ( $execute !== false ) {
return;
}
update_option( 'woocommerce_thumbnail_cropping', 'custom' );
update_option( 'woocommerce_thumbnail_cropping_custom_width', '23' );
update_option( 'woocommerce_thumbnail_cropping_custom_height', '35' );
if ( class_exists( 'WC_Regenerate_Images' ) ) {
$regenerate_obj = new WC_Regenerate_Images();
$regenerate_obj::init();
if ( method_exists( $regenerate_obj, 'maybe_regenerate_images' ) ) {
$regenerate_obj::maybe_regenerate_images();
} elseif ( method_exists( $regenerate_obj, 'maybe_regenerate_images_option_update' ) ) {
// Force woocommerce 3.3.1 to regenerate images
$regenerate_obj::maybe_regenerate_images_option_update( 1, 2, '' );
}
}
update_option( 'bigbang_update_woocommerce_customizer_controls', true );
}
add_action( 'after_setup_theme', 'bigbang_woocommerce_product_images_compatibility' );