Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #477068

    Dear Kriesi,

    I don’t understand how is working: related products are automatically added on the bottom of the page. But if you want to suggest really related products you can add them as “Linked Products” => “Up-Sells”
    For example for product Pheromone pour Homme http://goo.gl/GlNsFc we want to suggest also Pheromone pour Femme http://goo.gl/zD6ZGx
    and it works
    The problem is that is still displayed also a second line of “Related products” taken from the same category
    I would like to see
    “Related products” if nothing is specified in “Linked Products” => “Up-Sells”
    OR
    “You may also like…” if something is specified in “Linked Products” => “Up-Sells”
    one of the two, not both lines
    is that possible?
    Thank you Mauro

    #477122

    PS.
    I am using a function taken from your support to display 5 products
    ———————
    function avia_chance_wc_related_columns(){
    global $avia_config;
    $avia_config[‘shop_single_column’] = 5; // columns for related products and upsells
    $avia_config[‘shop_single_column_items’] = 5; // number of items for related products and upsells
    }
    add_action(‘wp_head’, ‘avia_chance_wc_related_columns’, 10);
    ———————-
    but the second line of products is displayed with or without this function

    #477520

    Hey!

    Thank you for using Enfold.

    They will both display by default. If you want to only display the upsells section if it’s available, use this in the functions.php file:

    #
    # display upsells and related products within dedicated div with different column and number of products
    #
    remove_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_related_products', 10);
    add_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_related_products_mod', 20);
    
    function avia_woocommerce_output_related_products_mod($items = false, $columns = false)
    {
    	global $avia_config;
    	$output = "";
    	
    	if(!$items) 	$items 	 = $avia_config['shop_single_column_items'];
    	if(!$columns) 	$columns = $avia_config['shop_single_column'];
    
    	ob_start();
    	woocommerce_related_products(array('posts_per_page'=>$items, 'columns'=>$columns)); // X products, X columns
    	$content = ob_get_clean();
    	if($content && $avia_config['upsells'] == '')
    	{
    		$output .= "<div class='product_column product_column_".$columns."'>";
    		//$output .= "<h3>".(__('Related Products', 'avia_framework'))."</h3>";
    		$output .= $content;
    		$output .= "</div>";
    	}
    
    	$avia_config['woo_related'] = $output;
    	return $output;
    
    }
    
    remove_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_upsells', 10); 
    add_action( 'woocommerce_after_single_product_summary', 'avia_woocommerce_output_upsells_mod', 21);
    
    function avia_woocommerce_output_upsells_mod($items = false, $columns = false)
    {
    	global $avia_config;
    
    	$output = "";
    	
    	if(!$items) 	$items 	 = $avia_config['shop_single_column_items'];
    	if(!$columns) 	$columns = $avia_config['shop_single_column'];
    	
    	ob_start();
    	woocommerce_upsell_display($items,$columns); // 4 products, 4 columns
    	$content = ob_get_clean();
    	if($content && $avia_config['woo_related'] == '')
    	{
    		$output .= "<div class='product_column product_column_".$columns."'>";
    		//$output .= "<h3>".(__('You may also like', 'avia_framework'))."</h3>";
    		$output .= $content;
    		$output .= "</div>";
    	}
    
    	$avia_config['woo_upsells'] = $output;
    	return $output;
    
    }

    Best regards,
    Ismael

    #477657

    Dear Ismael,

    I did it but nothing changed

    thank you Mauro

    #479458

    Hi!

    It should hide the related product section. Add this in the Quick CSS field:

    .product_column.product_column_5 + .product_column.product_column_5 {
      display: none !important;
    }

    Best regards,
    Ismael

    #479762

    It works

    Thank you very much

    Mauro

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘You may also like… OR Related products’ is closed to new replies.