Home Forums Basel support forum Products Navigation Product Page – Exclude categories/products from navigation

Products Navigation Product Page – Exclude categories/products from navigation

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

    acaro
    Participant

    Hi Support,

    For the shop page I was able to exclude a category of products from displaying there by adding code to my functions file. Is there a way to exclude this category or certain products from the navigation? Maybe it just skips over to the next product or just ignores it completely?

    If you guys cannot help me out with this code, where is the template located where I can modify this?

    Thanks!

    #57353

    Artem Temos
    Keymaster

    Hi,

    Please, describe us your problems in a bit more details. Attach some screenshots of the products and the navigation where do you want to exclude them?

    Thank you in advance.

    #57383

    acaro
    Participant

    Hi,

    I have attached a screenshot as you can see I would like to exclude them from the product page navigation that goes to the “next” or “prev” product. This could be for a category of products or individual ones.

    I had read in a previous post that you guys base it off the order of the products in shop page, so if I can hide products from showing there I would like them to not be included in the navigation as well.

    Thanks!

    Attachments:
    You must be logged in to view attached files.
    #57394

    Artem Temos
    Keymaster

    Hi,

    Sorry, but as you read on another topic, these posts are selected with WordPress core function and we can’t make it take into account your visibility parameters for products.

    Regards

    #57399

    acaro
    Participant

    Hi,

    But it is not based on the visibility of my products, its the function bellow checking and removing from the array those posts relating to a certain category. Then returning that array which is then displayed on the Shop page. Is there not a way to do a similar thing with the links?

    function custom_pre_get_posts_query( $q ) {

    if ( ! $q->is_main_query() ) return;
    if ( ! $q->is_post_type_archive() ) return;
    if ( ! is_admin() && is_shop() ) {
    $q->set( ‘tax_query’, array(array(
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => array( ‘grab-bag’,’replacement-parts’, ‘clearance’),
    ‘operator’ => ‘NOT IN’
    )));
    }
    remove_action( ‘pre_get_posts’, ‘custom_pre_get_posts_query’ );
    }

    Thanks!

    #57415

    Artem Temos
    Keymaster

    This code can’t be applied for products navigation either.

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