/*
 Theme Name:   Woodmart Child
 Description:  Woodmart Child Theme
 Author:       XTemos
 Author URI:   http://xtemos.com
 Template:     woodmart
 Version:      1.0.0
 Text Domain:  woodmart
*/

add_action('pre_get_posts', 'hide_archived_products_from_shop');

function hide_archived_products_from_shop($query) {
    if (!is_admin() && $query->is_main_query() && (is_shop() || is_product_category() || is_product_tag() || is_search())) {
        $tax_query = (array) $query->get('tax_query');

        $tax_query[] = array(
            'taxonomy' => 'product_cat',
            'field'    => 'slug',
            'terms'    => array('الأرشيف'), // أو 'archive' إذا كان بالإنجليزية
            'operator' => 'NOT IN',
        );

        $query->set('tax_query', $tax_query);
    }
}

