Get all product count from a order in Woocommerce

Question

I am having trouble with Woocommerce product details and order details relationship.

I need to get a count of products that have meta_key = ‘porduct_status_in_supplier’ and value of this meta is ‘no’ in order that order_id = ’55’

i try this SQL but not true

    select 
    COUNT(*) AS THE_COUNT
from 
    oc_posts as p,
    oc_postmeta as pm,
    oc_woocommerce_order_items as i,
    oc_woocommerce_order_itemmeta as im
where 
    p.post_type = 'shop_order'
    and p.ID = pm.post_id
    and p.ID = i.order_id
    and pm.meta_key = 'porduct_status_in_supplier'
    and pm.meta_value = 'no'
0
abukotsh gmail 4 months 0 Answers 14 views 0

Leave an answer