New Landing How can we help? Themeforest Theme Support Neighborhood similar products at the bottom

Viewing 9 posts - 1 through 9 (of 9 total)
  • #149095
    tomeronen
    Member
    Post count: 153

    Hey,

    very important question that we cannot solve!

    at the bottom of each product there are 4 or more products similar.

    we would like to repleace it with ‘products might interest you’ (from the attributes we have setted to each product). it works fine in the basket, when we check out it shows us ‘you may also be intersted in..”

    but we want these products to show up in every product page as well…

    thank you!

    T

    #149317
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Hi

    I’m afraid this functionality is controlled by WooCommerce not the theme, so you’re best contacting woocommerce support

    – Kyle

    #149322
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please paste this code at functions.php of child theme.

    add_filter( 'woocommerce_related_products_args', 'sf_woocommerce_rel_products' );
    function sf_woocommerce_rel_products( $args) {
    global $woocommerce_loop, $woocommerce, $product;
    
    $crosssells = $woocommerce->cart->get_cross_sells();
    
    if ( sizeof( $crosssells ) == 0 ) return;
    
    $meta_query = $woocommerce->query->get_meta_query();
    
    $args = array(
    	'post_type'           => 'product',
    	'ignore_sticky_posts' => 1,
    	'posts_per_page'      => apply_filters( 'woocommerce_cross_sells_total', 4 ),
    	'no_found_rows'       => 1,
    	'orderby'             => 'rand',
    	'post__in'            => $crosssells,
    	'meta_query'          => $meta_query
    );
    return $args;
    }
    

    Thanks
    Mohammad

    #149350
    tomeronen
    Member
    Post count: 153

    Thank you Muhammad! we think it works!

    we will play with it a bit and contact you:)

    THANKSSS

    #149356
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Thanks Mohammad

    – Kyle

    #149369
    tomeronen
    Member
    Post count: 153

    for some reason, it shows only one connected product and not all the products we set up in the attributes (products connected)….

    any idea?

    #149510
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779

    Can you try to remove this line below?

    'ignore_sticky_posts' => 1,

    -Rui

    #149511
    tomeronen
    Member
    Post count: 153

    It’s working thank you!! 🙂

    #149512
    Kyle – SUPPORT
    Moderator
    Post count: 35880

    Thanks Rui

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

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register