Display Paid Listing Price for Job Listings in WP Job Manager

Well we know all WP Job Manager. Suppose we are using WC Paid Listings for charging user for submitting job.

Suppose we need to show the listing price i.e how much user has paid then, here is a solutions.

 

function notinthemoods_get_job_listing_price( $job_id ) {
	global $wpdb;
	$order_itemmeta_sql = 'SELECT * FROM ' . 
	$wpdb->prefix . 'woocommerce_order_itemmeta WHERE 
	meta_key ="_job_id" AND meta_value=' .$job_id;

	$order_itemmeta_results = $wpdb->get_row( $order_itemmeta_sql , OBJECT );

	$order_items_sql = 'SELECT * FROM ' . 
	$wpdb->prefix . 'woocommerce_order_items WHERE 
	order_item_id =' .$order_itemmeta_results->order_item_id;
	$order_items_results = $wpdb->get_row( $order_items_sql , OBJECT );

	$order = new WC_Order( $order_items_results->order_id );
        $get_formatted_order_total = $order->get_formatted_order_total();
	return $get_formatted_order_total;
}

We need to pass the $job_id and it will return us the price.

Leave a Reply

Your email address will not be published. Required fields are marked *