Get WooCommerce order information like billing, shipping & date.

$order_id = 1234;
$order_data = new WC_Order($order_id);

//Order Date
$order_date = $order_data->order_date;    

//Billing information 
$billing = $order_data->get_address('billing'); 

//Shipping information 
$shipping = $order_data->get_address('shipping');
Advertisements

Get WordPress dynamic URL in JS file

//Include JS file

wp_enqueue_script('js_file', plugins_url('assets/js/js_file.js', __FILE__), array('jquery'), false);
wp_localize_script( 'js_file', 'WPURLS', array(
    'ajax_url' => admin_url( 'admin-ajax.php' )
));
	
// JS file
var url = WPURLS.ajax_url;