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;
}
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 number of project related to your requirement i add link please check
[login to view URL](Django)
[login to view URL](Codeigniter)
[login to view URL](Codeigniter)
[login to view URL](Codeigniter)
[login to view URL](Codeigniter)
[login to view URL](laravel)
[login to view URL](wordpress)