function has_bought() {
// Get all customer orders
$is_mask = true;
if(is_user_logged_in()){
$customer_orders = get_posts( array(
'numberposts' => 1, // one order is enough
'meta_key' => '_customer_user',
'meta_value' => get_current_user_id(),
'post_type' => 'shop_order', // WC orders post type
'post_status' => 'wc-completed', // Only orders with "completed" status
'fields' => 'ids', // Return Ids "completed"
));
// return "true" when customer has already at least one order (false if not)
f(count($customer_orders) > 0){
$is_mask = false;
};
}