Upgrade Woocommerce Function

I need to check if user bought specific product type, and if cost of this product was greater then 0 $ (if it was not free)

Needed product type:

job_package OR promotion_package

For now I have function to check if user bought anything, i would like something similar with mentionet upgrade.

function has_bought( $user_id = 0 ) {

global $wpdb;

$customer_id = $user_id == 0 ? get_current_user_id() : $user_id;

$paid_order_statuses = array_map( 'esc_sql', wc_get_is_paid_statuses() );

$results = $wpdb->get_col( "

SELECT [login to view URL] FROM {$wpdb->prefix}posts AS p

INNER JOIN {$wpdb->prefix}postmeta AS pm ON [login to view URL] = pm.post_id

WHERE p.post_status IN ( 'wc-" . implode( "','wc-", $paid_order_statuses ) . "' )

AND p.post_type LIKE 'shop_order'

AND pm.meta_key = '_customer_user'

AND pm.meta_value = $customer_id

" );

// Count number of orders and return a boolean value depending if higher than 0

return count( $results ) > 0 ? true : false;


Kemahiran: PHP, MySQL, Wordpress, Kejuruteraan Perisian, SQL

Lihat lagi: function count number posted data php, list number orders status oscommerce, woocommerce database stock status, woocommerce code, woocommerce classes, woocommerce internal api, woocommerce product functions, woocommerce functions documentation, woocommerce hooks, woocommerce email functions, woocommerce price hook, hello all i need is 90 into my skrill acount bcuze i cant withdrall my, i have 300 names in excel file need to done copy from excel file into notepad file, i have created an app where you can sell stuff and chat directly with the seller i need a logo for this app to be used on the ap, i have started a new job as a tour guide and i need some audio transcribing from a colleagues tour of oxford stratford upon avon, i need a graphic artisist from san diego, i need a job working from home, i need a marketing person from singapoure, write a story that illustrate expression a friend in need is a friend in deed, online translator all you need is one bite

Tentang Majikan:
( 0 ulasan ) Poland

ID Projek: #23463686

Dianugerahkan kepada:


Hi Please let us know your details requirements so we could analyze it and start working. we have few questions to clarify before we start, could you kindly reply us. Relevant Skills and Experience I already completed Lagi

$10 USD dalam 7 hari
(0 Ulasan)

2 pekerja bebas membida secara purata $10 untuk pekerjaan ini


Some of my previously built websites are:- 1) [login to view URL] 2) [login to view URL] 3) [login to view URL] 4) [login to view URL] I'd love working with you. Let's talk furthur i Lagi

$10 USD dalam 3 hari
(1 Ulasan)