Home Forums WoodMart support forum Related products

Related products

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #41359

    MoeMauphie
    Participant

    Hi there,

    Could please tell me how and based on what factors the related products are chosen? Is there there anyway to modify it?

    #41366

    MoeMauphie
    Participant

    I’d like to show products from the same category and brand. Is it possible?

    Regards

    #41372

    Artem Temos
    Keymaster

    Hello,

    You can read the information about the related products section in WooCommerce plugin’s documentation https://docs.woocommerce.com/document/related-products-up-sells-and-cross-sells/

    Regards

    #41377

    MoeMauphie
    Participant

    Thanks for your reply,

    I read it and I tried to use this code but to no avail. Could you please see if it’s compatible with your theme?

    function custom_related_product_args ( $args ){
        global $product;
    
        $cats          = wc_get_product_terms( $product->id, 'product_cat', array( 'fields' => 'slugs' ) );
        $brands        = wc_get_product_terms( $product->id, 'pa_brand', array( 'fields' => 'slugs' ) );
    
        unset( $args['post__in'] );
        $args['tax_query'] = array( 
            'relation' => 'AND',
            array(
                'taxonomy' => 'product_cat',
                'field'    => 'slug',
                'terms'    => $cats,
            ),
            array(
                'relation' => 'AND',
                array(
                    'taxonomy' => 'pa_brand',
                    'field'    => 'slug',
                    'terms'    => $brands,
                ),
    
            )
        );
    
        return $args;
    }
    add_filter('woocommerce_related_products_args', 'custom_related_product_args');

    Many Thanks,

    #41391

    Artem Temos
    Keymaster

    Does this code works correctly with default WordPress theme?

    #41535

    MoeMauphie
    Participant

    I can’t test it with the default theme at the moment, because when I change the theme and go back to Woodmart, I lose some settings.

    I’ll try to find some developer to help me with that.

    Thanks guys

    #41583

    Artem Temos
    Keymaster

    OK, contact us if you will have any extra questions.

    #41588

    MoeMauphie
    Participant

    Meanwhile, could please add the owl slider feature for upsells and crosssells in your future updates?

    Many Thanks

    #41606

    Artem Temos
    Keymaster

    But this function is already implemented in our theme. Carousel for upsells and related products can be enabled in Theme Settings -> Product page -> Show / Hide elements.
    Cross-sells carousel is enabled by default.

    #41621

    MoeMauphie
    Participant

    I didn’t see a separate option for upsells, so by setting “Related product view” to slider, it will be enabled for both upsells and related products, is my assumption right?
    That’s great by the way.

    #41637

    Artem Temos
    Keymaster

    Yes, this option works for both sections. Probably, we should mention this information there.

    #41652

    MoeMauphie
    Participant

    Thanks a lot,

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

The topic ‘Related products’ is closed to new replies.