Home Forums WoodMart support forum Hide sold out – product tabs

Hide sold out – product tabs

Viewing 30 posts - 1 through 30 (of 32 total)
  • Author
    Posts
  • #28703

    yuriix
    Participant

    Hello, when i check hide sold out in warehouse only 2 products will appear in the product tabs and should be 6. 6 is set.

    where is the problem? Why do not the tabs fill up to 6?

    Thank you.

    #28720

    Artem Temos
    Keymaster

    Hi,

    Could you please provide us your admin access so we can check what is wrong?

    Regards

    #28867

    yuriix
    Participant

    Hello,
    yes.

    #28868

    yuriix
    Participant

    and when i use infinity scroll the are blank places.

    #28872

    Artem Temos
    Keymaster

    Could you please provide us your FTP access also?

    #28884

    yuriix
    Participant

    yes

    #28893

    Artem Temos
    Keymaster

    Could you please check how it works currently?

    #28904

    yuriix
    Participant

    Now it looks alright. Where was the problem?

    #28918

    Artem Temos
    Keymaster

    We don’t know why it happens for your website. We tested this on our demo and it worked fine.
    We added a few lines of code to the child theme to fix it particularly for you.

    #28922

    yuriix
    Participant

    Can you send me the edited files? I have one more eshop where this problem is.

    Thank you.

    #28930

    Artem Temos
    Keymaster

    You can find the edited file in the folder /wp-content/themes/woodmart-child/functions.php.

    #28934

    yuriix
    Participant

    ok, thank you.

    #28938

    Artem Temos
    Keymaster

    You are welcome!

    #28949

    yuriix
    Participant

    now I find that I have exactly the same problem on category product page.

    #28950

    Artem Temos
    Keymaster

    Could you please try to switch to default WordPress theme and check how it works?

    #28952

    yuriix
    Participant

    on this domain certainly not, but I can try it on other. where he does it too.

    #28956

    yuriix
    Participant

    i try storefront theme and there he does it too. it happens only if i turn off products that are not in stock.

    #28981

    Artem Temos
    Keymaster

    Do you mean that it happens with other themes too? In this case, the issue seems to be caused by some of installed plugins or it is a bug in WooCommerce plugin.

    #29107

    yuriix
    Participant

    yes, other templates do it too. it looks like a bug in Woocommerce. :/

    #29122

    yuriix
    Participant

    the same problem I found here, unfortunately it is not solved.
    https://wordpress.org/support/topic/out-of-stock-products-leaving-holes-on-shop-page/

    #29125

    yuriix
    Participant

    as you’ve fixed the tabs on the home page. would it be possible fix product list as home page?

    sorry for english 🙂

    #29139

    Artem Temos
    Keymaster

    Sorry, but this fix will not work for the shop page since we can’t control a database query on the shop page. Here is some similar issue with a solution, try this https://github.com/woocommerce/woocommerce/issues/8825

    #30820

    yuriix
    Participant

    unfortunately I have not solved it yet.

    #30827

    Artem Temos
    Keymaster

    In this situation, you need to contact plugin’s developers for help since it is not our theme bug. And we don’t have a quick solution for this to help you .

    #36180

    yuriix
    Participant

    Hi,
    i updata theme to lastet version but product hide. The same bug / error as before we fixed it on the main page.

    Help.

    #36198

    Artem Temos
    Keymaster

    Hi,

    Did you update the WooCommerce plugin to the latest 3.3 version as well?

    #36992

    yuriix
    Participant

    Hi,
    yes, woocommerce is 3.3.0.

    #36995

    Artem Temos
    Keymaster

    Could you please remind the problem you have now?

    1. You see out of stock products on the home page?

    2. Do you see out of stock products?

    3. Does it happen with our theme or with other themes as well?

    #37478

    yuriix
    Participant

    1. Out of stock is disablet. If the OUT OF STOCK is on, everything is all right. Last we solved this by adding a few lines to the code. see up. … homepage.
    (We don’t know why it happens for your website. We tested this on our demo and it worked fine.
    We added a few lines of code to the child theme to fix it particularly for you.)

    2. OUT OF STOCK I see if it is turned on.

    3. this happens with each template, but we have solved this last (on the main page) that a few lines of code have been added.

    I need add this code. I do not know which code it was and if it worked ok.

    #37512

    Artem Temos
    Keymaster

    Try to add the following PHP code snippet to the child theme functions.php file to fix this

    function woodmart_shortcode_products($atts, $query = false) {
    		global $woocommerce_loop, $woodmart_loop;
    		
    	    $parsed_atts = shortcode_atts( woodmart_get_default_product_shortcode_atts(), $atts );
    
    		extract( $parsed_atts );
    
    		$woodmart_loop['img_size'] = $img_size;
    
    		$woocommerce_loop['masonry'] = $products_masonry;
    		$woocommerce_loop['different_sizes'] = $products_different_sizes;
    
    	    $is_ajax = (defined( 'DOING_AJAX' ) && DOING_AJAX && $force_not_ajax != 'yes' );
    
    	    $parsed_atts['force_not_ajax'] = 'no'; // :)
    
    	    $encoded_atts = json_encode( $parsed_atts );
    
    		$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    
    		if( $ajax_page > 1 ) $paged = $ajax_page;
    
    		$ordering_args = WC()->query->get_catalog_ordering_args( $orderby, $order );
    
    		$meta_query   = WC()->query->get_meta_query();
    
    		$tax_query   = WC()->query->get_tax_query();
    		
    		if ( $post_type == 'new' ){
    			$meta_query[] = array(
    				'key'     => '_woodmart_new_label',
    				'value'   => 'on',
    				'operator' => 'IN',
    			);
    		}
    
    		if( $orderby == 'post__in' ) {
    			$ordering_args['orderby'] = $orderby;
    		}
    
    	    $args = array(
    	    	'post_type' 			=> 'product',
    	    	'post_status' 			=> 'publish',
    			'ignore_sticky_posts' 	=> 1,
    	    	'paged' 			  	=> $paged,
    			'orderby'             	=> $ordering_args['orderby'],
    			'order'               	=> $ordering_args['order'],
    	    	'posts_per_page' 		=> $items_per_page,
    	    	'meta_query' 			=> $meta_query,
    	    	'tax_query'             => $tax_query,
    		);
    
    		if( ! empty( $ordering_args['meta_key'] ) ) {
    			$args['meta_key'] = $ordering_args['meta_key'];
    		}
    
    		if( $post_type == 'ids' && $include != '' ) {
    			$args['post__in'] = explode(',', $include);
    		}
    
    		if( ! empty( $exclude ) ) {
    			$args['post__not_in'] = explode(',', $exclude);
    		}
    
    		if( ! empty( $taxonomies ) ) {
    			$taxonomy_names = get_object_taxonomies( 'product' );
    			$terms = get_terms( $taxonomy_names, array(
    				'orderby' => 'name',
    				'include' => $taxonomies
    			));
    
    			if( ! is_wp_error( $terms ) && ! empty( $terms ) ) {
    				if( $post_type == 'featured' ) $args['tax_query'] = array( 'relation' => 'AND' );
    
    				if( count( $terms ) > 1 ) $args['tax_query']['categories'] = array( 'relation' => 'OR' );
    
    				foreach ( $terms as $term ) {
    					$args['tax_query']['categories'][] = array(
    						'taxonomy' => $term->taxonomy,
    					    'field' => 'slug',
    					    'terms' => array( $term->slug ),
    					    'include_children' => true,
    					    'operator' => 'IN'
    					);
    				}
    			}
    		}
    
    		if( $post_type == 'featured' ) {
    			$args['tax_query'][] = array(
    				'taxonomy' => 'product_visibility',
    				'field'    => 'name',
    				'terms'    => 'featured',
    				'operator' => 'IN',
    			);
    		}
    
    		if( ! empty( $order ) ) {
    			$args['order'] = $order;
    		}
    
    		if( ! empty( $offset ) ) {
    			$args['offset'] = $offset;
    		}
    
    		if( $post_type == 'sale' ) {
    			$args['post__in'] = array_merge( array( 0 ), wc_get_product_ids_on_sale() );
    		}
    
    		if( $post_type == 'bestselling' ) {
    			$args['orderby'] = 'meta_value_num';
    			$args['meta_key'] = 'total_sales';
    		}
    		
    		if ( 'yes' === get_option( 'woocommerce_hide_out_of_stock_items' ) ) {
    			$args['meta_query'][] = array( 'key' => '_stock_status', 'value' => 'outofstock', 'compare' => 'NOT IN' );
    		}
    
    		$woocommerce_loop['timer']   = $sale_countdown;
    		$woocommerce_loop['product_hover']   = $product_hover;
    		$woocommerce_loop['products_view']  = $layout;
    		
    		$woocommerce_loop['is_shortcode'] = true;
    
    		$products = new WP_Query( $args );
    
    		WC()->query->remove_ordering_args();
    
    		$woocommerce_loop['timer']   = $sale_countdown;
    		$woocommerce_loop['product_hover']   = $product_hover;
    
    		// Simple products carousel
    		if( $layout == 'carousel' ) return woodmart_generate_posts_slider( $parsed_atts, $products );
    
    		if ( WC()->version < '3.3.0' ){
    			$woocommerce_loop['columns'] = $columns;
    		}else{
    			wc_set_loop_prop( 'columns', $columns );
    		}
    
    		if ( $pagination != 'arrows' ) {
    			$woocommerce_loop['loop'] = $items_per_page * ( $paged - 1 );
    		}
    		
    		if ( $layout == 'list' ) {
    			$class .= ' elements-list';
    		}else{
    			$class .= ' woodmart-spacing-' . $spacing;
    			$class .= ' products-spacing-' . $spacing;
    			$class .= ' grid-columns-' . $columns;
    		}
    		
    		$class .= ' pagination-' . $pagination;
    		if( $woocommerce_loop['masonry'] == 'enable') {
    			$class .= ' grid-masonry';
    		}
    
    		ob_start();
    
    		if( ! $is_ajax) echo '<div class="woodmart-products-element">';
    
    	    if( ! $is_ajax && $pagination == 'arrows' ) echo '<div class="woodmart-products-loader"></div>';
    
    	    if( ! $is_ajax) echo '<div class="products elements-grid row woodmart-products-holder ' . esc_attr( $class) . '" data-paged="1" data-atts="' . esc_attr( $encoded_atts ) . '" data-source="shortcode">';
    
    		if ( $products->have_posts() ) :
    			while ( $products->have_posts() ) :
    				$products->the_post();
    				wc_get_template_part( 'content', 'product' );
    			endwhile;
    		endif;
    
        	if(!$is_ajax) echo '</div>';
    
    		woocommerce_reset_loop();
    		wp_reset_postdata();
    		woodmart_reset_loop();
    
    		if ( $products->max_num_pages > 1 && !$is_ajax ) {
    			?>
    		    	<div class="products-footer">
    		    		<?php if ($pagination == 'more-btn' || $pagination == 'infinit'): ?>
    		    			<a href="#" class="btn woodmart-load-more woodmart-products-load-more load-on-<?php echo ($pagination == 'more-btn') ? 'click' : 'scroll'; ?>"><span class="load-more-label"><?php esc_html_e('Load more products', 'woodmart'); ?></span><span class="load-more-loading"><?php esc_html_e('Loading...', 'woodmart'); ?></span></a>
    		    		<?php elseif ($pagination == 'arrows'): ?>
    		    			<div class="wrap-loading-arrow">
    			    			<div class="woodmart-products-load-prev disabled"><?php esc_html_e('Load previous products', 'woodmart'); ?></div>
    			    			<div class="woodmart-products-load-next"><?php esc_html_e('Load next products', 'woodmart'); ?></div>
    		    			</div>
    		    		<?php endif ?>
    		    	</div>
    		    <?php
    		}
    
        	if(!$is_ajax) echo '</div>';
    
    		$output = ob_get_clean();
    
    	    if( $is_ajax ) {
    	    	$output =  array(
    	    		'items' => $output,
    	    		'status' => ( $products->max_num_pages > $paged ) ? 'have-posts' : 'no-more-posts'
    	    	);
    	    }
    
    	    return $output;
    
    	}
    	add_shortcode( 'woodmart_products', 'woodmart_shortcode_products' );
Viewing 30 posts - 1 through 30 (of 32 total)