Home Forums WoodMart support forum AJAX Products tabs only current category

AJAX Products tabs only current category

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #700471

    dainius-4606
    Participant

    Hello,

    How can I get only current category in AJAX Products tabs without child categories? It shows with subcategories, I don’t need this. Screenshots attached.
    AJAX Products tabs is in front page.

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

    Hello,

    Currently, the Exclude option in the AJAX Products Tabs widget only allows you to exclude individual products by title or ID. It does not provide the ability to exclude entire subcategories, so all products from the current category and its child categories will still appear.

    You can use the Exclude field to remove specific products if needed, but excluding child categories is not available in this widget: https://ibb.co/bMPRZNLY

    Best Regards,

    #700674

    dainius-4606
    Participant

    Hello, maybe there is any function to exclude child categories?

    #700705

    Hello,

    Currently, the Exclude option in the AJAX Products Tabs widget only allows you to exclude individual products by title or ID. It does not provide the ability to exclude entire subcategories, so all products from the current category and its child categories will still appear.

    You can use the Exclude field to remove specific products if needed, but excluding child categories is not available in this widget: https://ibb.co/bMPRZNLY

    Best Regards,

    #700986

    dainius-4606
    Participant

    Hello,

    Maybe I can do like this function? But it doesn’t work with AJAX Products Tabs, I think there is some different query.

    add_action( ‘woocommerce_product_query’, ‘bbloomer_hide_products_subcategory’, 9999 );

    function bbloomer_hide_products_subcategory( $q ) {

    if ( ! is_product_category() ) return;

    $parent_id = get_queried_object_id();
    $subcats = woocommerce_get_product_subcategories( $parent_id );
    if ( empty( $subcats ) ) return;

    $tax_query = (array) $q->get( ‘tax_query’ );
    $tax_query[] = array(
    ‘taxonomy’ => ‘product_cat’,
    ‘field’ => ‘slug’,
    ‘terms’ => array_column( $subcats, ‘slug’ ),
    ‘operator’ => ‘NOT IN’
    );

    $q->set( ‘tax_query’, $tax_query, true );

    }

    #701058

    Hello,

    Sorry to say, it requires customization and is beyond our support policy. Additional code customizations in theme files are out of our theme support scope.

    Hope you can understand!

    Best Regards,

    #701103

    dainius-4606
    Participant

    Thank you! Please close this topic.

    #701125

    Hello,

    You’re Most Welcome!

    Feel free to write back anytime. If you need further assistance, we are always here to help you.

    If you have a minute, we’d truly appreciate your feedback — it helps us improve the product and shape future updates more effectively. We’d love your feedback on our theme: https://tally.so/r/w4l54k

    Thanks for contacting us.
    Have a great day.

    Topic Closed.
    Best Regards.

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

The topic ‘AJAX Products tabs only current category’ is closed to new replies.