Home Forums WoodMart support forum Related products not showing

Related products not showing

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #459738

    manage
    Participant

    Dear Support,

    After installing WoodMart theme on our website, related products disappeared, even though they are enabled in our theme settings.

    In our single product page (woodmart-child/woocommerce/content-single-product.php), we’re using the following code:

    
    		
    			<?php do_action( 'woocommerce_after_single_product' ); ?>
    		    <!-- begin grid-container -->
    		    <div class="grid-container product_related_wrapper ">
    				<!-- begin single_product_summary_upsell -->
    				<div class="single_product_summary_upsell product_carousel">
    					<!-- begin grid-x -->
    					<div class="grid-x">
    						<!-- begin cell -->
    						<div class="cell large-12">
    							<?php do_action( 'woocommerce_after_single_product_summary_upsell_display' ); ?>
    						</div>
    						<!-- end cell -->
    					</div>
    					<!-- end grid-x -->
    				</div>
    				<!-- end single_product_summary_upsell -->
    
    				<!-- begin single_product_summary_related -->
    				<div class="single_product_summary_related product_carousel">
    					<!-- begin grid-x -->
    					<div class="grid-x">
    						<!-- begin cell -->
    						<div class="cell large-12">		
    							<?php do_action( 'woocommerce_after_single_product_summary_related_products' ); ?>
    						</div>
    						<!-- end cell -->
    					</div>
    					<!-- end grid-x -->
    				</div>
    				<!-- end single_product_summary_related -->    	
    		    </div>
    		    <!-- end grid-container -->	
    

    We also tried this one, but same result. Related products are not showing and the variable $related_products returns an error.

    $related_product_view = woodmart_get_opt( 'related_product_view' );
    
    if ( $related_products ) : ?>
    
    	<div class="related-products">
    		
    		<?php
    		$heading = apply_filters( 'woocommerce_product_related_products_heading', __( 'Related products', 'woocommerce' ) );
    		
    		if ( $heading ) :
    			?>
    		<h3 class="title slider-title"><?php echo esc_html( $heading ); ?></h3>
    		<?php endif; ?>
    		
    		<?php
    			woodmart_enqueue_product_loop_styles( woodmart_get_opt( 'products_hover' ) );
    			if ( $related_product_view == 'slider' ) {
    				$slider_args = array(
    					'slides_per_view'              => ( woodmart_get_opt( 'related_product_columns' ) ) ? woodmart_get_opt( 'related_product_columns' ) : apply_filters( 'woodmart_related_products_per_view', 4 ),
    					'img_size'                     => 'woocommerce_thumbnail',
    					'products_bordered_grid'       => woodmart_get_opt( 'products_bordered_grid' ),
    					'products_bordered_grid_style' => woodmart_get_opt( 'products_bordered_grid_style' ),
    					'products_with_background'     => woodmart_get_opt( 'products_with_background' ),
    					'products_shadow'              => woodmart_get_opt( 'products_shadow' ),
    					'products_color_scheme'        => woodmart_get_opt( 'products_color_scheme' ),
    					'custom_sizes'                 => apply_filters( 'woodmart_product_related_custom_sizes', false ),
    					'product_quantity'             => woodmart_get_opt( 'product_quantity' )
    				);
    				
    				woodmart_set_loop_prop( 'products_view', 'carousel' );
    
    				echo woodmart_generate_posts_slider( $slider_args, false, $related_products );
    			}elseif ( $related_product_view == 'grid' ) {
    		
    				woodmart_set_loop_prop( 'products_columns', woodmart_get_opt( 'related_product_columns' ) );
    				woodmart_set_loop_prop( 'products_different_sizes', false );
    				woodmart_set_loop_prop( 'products_masonry', false );
    				woodmart_set_loop_prop( 'products_view', 'grid' );
    				
    				woocommerce_product_loop_start();
    
    				foreach ( $related_products as $related_product ) {
    					$post_object = get_post( $related_product->get_id() );
    
    					setup_postdata( $GLOBALS['post'] = $post_object );
    
    					wc_get_template_part( 'content', 'product' ); 
    				}
    
    				woocommerce_product_loop_end();
    				
    				woodmart_reset_loop();
    				
    				if ( function_exists( 'woocommerce_reset_loop' ) ) woocommerce_reset_loop();
    			}
    			
    		?>
    		
    	</div>
    
    <?php endif;
    
    wp_reset_postdata();
    #459763

    Hello,

    Thank you very much for choosing our theme and for contacting us.

    Please deactivate all the plugins except these ones:

    Slider Revolution
    WPBakery Page Builder or Elementor
    Woodmart Core
    Contact Form 7
    MailChimp for WordPress
    WooCommerce
    Safe SVG
    if you have added any customization to the child theme, please activate the parent.

    If the problem has gone, activate the plugins one by one, checking the issue to detect which one causes the problem.

    In case, the problem remains, even after all the plugins are deactivated, provide your site admin access (insert the site credentials into the Private content block under the message area) and confirm the permission for plugins deactivation, switching to the parent or default theme. As soon as we complete the testing we will enable all back, however, the site would be without plugins for 15-20 min. You would better make the full backup of your site.

    Best Regards

Viewing 2 posts - 1 through 2 (of 2 total)