Home › Forums › WoodMart support forum › Hide sold out – product tabs
Hide sold out – product tabs
- This topic has 31 replies, 2 voices, and was last updated 6 years, 9 months ago by Artem Temos.
-
AuthorPosts
-
December 13, 2017 at 11:48 am #28703
yuriixParticipantHello, 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.
December 13, 2017 at 12:28 pm #28720
Artem TemosKeymasterHi,
Could you please provide us your admin access so we can check what is wrong?
Regards
December 14, 2017 at 9:56 am #28867
yuriixParticipantHello,
yes.December 14, 2017 at 10:25 am #28868
yuriixParticipantand when i use infinity scroll the are blank places.
December 14, 2017 at 10:38 am #28872
Artem TemosKeymasterCould you please provide us your FTP access also?
December 14, 2017 at 11:20 am #28884
yuriixParticipantyes
December 14, 2017 at 12:41 pm #28893
Artem TemosKeymasterCould you please check how it works currently?
December 14, 2017 at 2:19 pm #28904
yuriixParticipantNow it looks alright. Where was the problem?
December 14, 2017 at 2:49 pm #28918
Artem TemosKeymasterWe 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.December 14, 2017 at 3:03 pm #28922
yuriixParticipantCan you send me the edited files? I have one more eshop where this problem is.
Thank you.
December 14, 2017 at 3:27 pm #28930
Artem TemosKeymasterYou can find the edited file in the folder
/wp-content/themes/woodmart-child/functions.php
.December 14, 2017 at 3:29 pm #28934
yuriixParticipantok, thank you.
December 14, 2017 at 3:30 pm #28938
Artem TemosKeymasterYou are welcome!
December 14, 2017 at 4:09 pm #28949
yuriixParticipantnow I find that I have exactly the same problem on category product page.
December 14, 2017 at 4:14 pm #28950
Artem TemosKeymasterCould you please try to switch to default WordPress theme and check how it works?
December 14, 2017 at 4:19 pm #28952
yuriixParticipanton this domain certainly not, but I can try it on other. where he does it too.
December 14, 2017 at 4:39 pm #28956
yuriixParticipanti try storefront theme and there he does it too. it happens only if i turn off products that are not in stock.
December 14, 2017 at 8:52 pm #28981
Artem TemosKeymasterDo 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.
December 15, 2017 at 3:09 pm #29107
yuriixParticipantyes, other templates do it too. it looks like a bug in Woocommerce. :/
December 15, 2017 at 5:21 pm #29122
yuriixParticipantthe same problem I found here, unfortunately it is not solved.
https://wordpress.org/support/topic/out-of-stock-products-leaving-holes-on-shop-page/December 15, 2017 at 5:56 pm #29125
yuriixParticipantas you’ve fixed the tabs on the home page. would it be possible fix product list as home page?
sorry for english 🙂
December 15, 2017 at 6:36 pm #29139
Artem TemosKeymasterSorry, 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
December 28, 2017 at 5:26 pm #30820
yuriixParticipantunfortunately I have not solved it yet.
December 28, 2017 at 6:28 pm #30827
Artem TemosKeymasterIn 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 .
January 30, 2018 at 4:54 pm #36180
yuriixParticipantHi,
i updata theme to lastet version but product hide. The same bug / error as before we fixed it on the main page.Help.
January 30, 2018 at 6:22 pm #36198
Artem TemosKeymasterHi,
Did you update the WooCommerce plugin to the latest 3.3 version as well?
February 2, 2018 at 12:50 pm #36992
yuriixParticipantHi,
yes, woocommerce is 3.3.0.February 2, 2018 at 12:53 pm #36995
Artem TemosKeymasterCould 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?
February 5, 2018 at 10:42 am #37478
yuriixParticipant1. 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.
February 5, 2018 at 12:46 pm #37512
Artem TemosKeymasterTry 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' );
-
AuthorPosts
Tagged: hide, product tabs, sold out
- You must be logged in to create new topics. Login / Register