Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #539791

    Hi,

    How can I show only products of same categories in previous and next product arrows in the product page?

    Thank you

    Best regards,
    Salvatore

    #541192
    #541484

    Hey Elliot, i have wrote the following code in functions.php, but it doesn’t work.

    add_filter('avia_post_nav_categories', 'use_same_category_filter');
        function use_same_category_filter($same_category)
        {
            $same_category = true;
            return $same_category;
        }
    

    I have read that the filter in Enfold has changed a bit (https://kriesi.at/support/topic/avia-post-nav-with-the-same-category-not-work), and so i have wrote the following code in functions.php.
    With this function Enfold doesn’t show the arrows to change product, also if there is another product in the same category.

    add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
        function avia_same_category_filter($settings) {
            $settings['same_category'] = true;
            return $settings;
        }

    thank you
    best regards
    Salvatore

    #543473

    Hey!

    Please use this instead:

    add_filter('avia_post_nav_settings','avia_same_category_filter', 10, 1);
    function avia_same_category_filter($settings) {
        if(is_singular('product')) {
            $settings['taxonomy'] = 'product_cat';
            $settings['same_category'] = true;
        }
        
        return $settings;
    }

    This is only going to work if the products are not included on multiple product categories.

    Cheers!
    Ismael

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.