Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
523 B
2
Indexable
function filter_orders_by_product_id($bool, $order)
{

    $skip_product_ids = []; //ID продуктов с которыми пропускать

    if ($order) {
        $order_items = $order->get_items();
        foreach ($order_items as $item)
        {   
            $product_id = $item->get_product_id();


            if (in_array($product_id, $skip_product_ids)) {
                return True;
            }
        }
    }


}

add_filter('itglx_wcamo_do_not_send_order', 'filter_orders_by_product_id', 10, 2);