diff --git a/includes/abstracts/abstract-wc-payment-gateway.php b/includes/abstracts/abstract-wc-payment-gateway.php
index 2c4e7f0c2bd..c4a2e23da4a 100644
--- a/includes/abstracts/abstract-wc-payment-gateway.php
+++ b/includes/abstracts/abstract-wc-payment-gateway.php
@@ -100,7 +100,7 @@ abstract class WC_Payment_Gateway extends WC_Settings_API {
// Gets order total from "pay for order" page.
if ( 0 < $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$total = (float) $order->get_total();
// Gets order total from cart/checkout.
diff --git a/includes/admin/class-wc-admin-post-types.php b/includes/admin/class-wc-admin-post-types.php
index 0a0fec61124..c2743d02b19 100644
--- a/includes/admin/class-wc-admin-post-types.php
+++ b/includes/admin/class-wc-admin-post-types.php
@@ -439,7 +439,7 @@ class WC_Admin_Post_Types {
global $post, $woocommerce, $the_order;
if ( empty( $the_order ) || $the_order->id != $post->ID ) {
- $the_order = get_order( $post->ID );
+ $the_order = wc_get_order( $post->ID );
}
switch ( $column ) {
@@ -1180,7 +1180,7 @@ class WC_Admin_Post_Types {
$post_ids = array_map( 'absint', (array) $_REQUEST['post'] );
foreach ( $post_ids as $post_id ) {
- $order = get_order( $post_id );
+ $order = wc_get_order( $post_id );
$order->update_status( $new_status, __( 'Order status changed by bulk edit:', 'woocommerce' ) );
$changed++;
}
@@ -2039,7 +2039,7 @@ class WC_Admin_Post_Types {
$existing_permissions = $wpdb->get_results( $wpdb->prepare( "SELECT * from {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE product_id = %d GROUP BY order_id", $product_id ) );
foreach ( $existing_permissions as $existing_permission ) {
- $order = get_order( $existing_permission->order_id );
+ $order = wc_get_order( $existing_permission->order_id );
if ( $order->id ) {
// Remove permissions
diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php b/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php
index 921a6c08bf9..fe1b12cb2bb 100644
--- a/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php
+++ b/includes/admin/meta-boxes/class-wc-meta-box-order-actions.php
@@ -21,7 +21,7 @@ class WC_Meta_Box_Order_Actions {
global $theorder;
if ( ! is_object( $theorder ) ) {
- $theorder = get_order( $post->ID );
+ $theorder = wc_get_order( $post->ID );
}
$order = $theorder;
@@ -85,7 +85,7 @@ class WC_Meta_Box_Order_Actions {
*/
public static function save( $post_id, $post ) {
// Order data saved, now get it so we can manipulate status
- $order = get_order( $post_id );
+ $order = wc_get_order( $post_id );
// Handle button actions
if ( ! empty( $_POST['wc_order_action'] ) ) {
diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-data.php b/includes/admin/meta-boxes/class-wc-meta-box-order-data.php
index be5b2b971df..e11ad3bfc00 100644
--- a/includes/admin/meta-boxes/class-wc-meta-box-order-data.php
+++ b/includes/admin/meta-boxes/class-wc-meta-box-order-data.php
@@ -133,7 +133,7 @@ class WC_Meta_Box_Order_Data {
global $theorder;
if ( ! is_object( $theorder ) ) {
- $theorder = get_order( $post->ID );
+ $theorder = wc_get_order( $post->ID );
}
$order = $theorder;
@@ -441,7 +441,7 @@ class WC_Meta_Box_Order_Data {
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_date = %s, post_date_gmt = %s WHERE ID = %s", $date, get_gmt_from_date( $date ), $post_id ) );
// Order data saved, now get it so we can manipulate status
- $order = get_order( $post_id );
+ $order = wc_get_order( $post_id );
// Order status
$order->update_status( $_POST['order_status'] );
diff --git a/includes/admin/meta-boxes/class-wc-meta-box-order-items.php b/includes/admin/meta-boxes/class-wc-meta-box-order-items.php
index 0827d6aeb6b..6a91da61101 100644
--- a/includes/admin/meta-boxes/class-wc-meta-box-order-items.php
+++ b/includes/admin/meta-boxes/class-wc-meta-box-order-items.php
@@ -21,7 +21,7 @@ class WC_Meta_Box_Order_Items {
global $thepostid, $theorder;
if ( ! is_object( $theorder ) ) {
- $theorder = get_order( $thepostid );
+ $theorder = wc_get_order( $thepostid );
}
$order = $theorder;
diff --git a/includes/admin/reports/class-wc-report-customer-list.php b/includes/admin/reports/class-wc-report-customer-list.php
index e23227f1b7e..e21f59d59ab 100644
--- a/includes/admin/reports/class-wc-report-customer-list.php
+++ b/includes/admin/reports/class-wc-report-customer-list.php
@@ -163,7 +163,7 @@ class WC_Report_Customer_List extends WP_List_Table {
) );
if ( $order_ids ) {
- $order = get_order( $order_ids[0] );
+ $order = wc_get_order( $order_ids[0] );
echo '' . $order->get_order_number() . ' – ' . date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) );
} else echo '-';
diff --git a/includes/api/class-wc-api-orders.php b/includes/api/class-wc-api-orders.php
index 5b71eaff6a9..5b1d0432108 100644
--- a/includes/api/class-wc-api-orders.php
+++ b/includes/api/class-wc-api-orders.php
@@ -116,7 +116,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( is_wp_error( $id ) )
return $id;
- $order = get_order( $id );
+ $order = wc_get_order( $id );
$order_post = get_post( $id );
@@ -427,7 +427,7 @@ class WC_API_Orders extends WC_API_Resource {
$data = apply_filters( 'woocommerce_api_edit_order_data', $data, $id, $this );
- $order = get_order( $id );
+ $order = wc_get_order( $id );
$order_args = array( 'order_id' => $order->id );
@@ -1103,7 +1103,7 @@ class WC_API_Orders extends WC_API_Resource {
return new WP_Error( 'woocommerce_api_invalid_order_id', __( 'Order ID is invalid', 'woocommerce' ), array( 'status' => 400 ) );
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$data = apply_filters( 'woocommerce_api_create_order_note_data', $data, $order_id, $this );
@@ -1149,7 +1149,7 @@ class WC_API_Orders extends WC_API_Resource {
return $order_id;
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
// validate note ID
$id = absint( $id );
diff --git a/includes/api/v1/class-wc-api-orders.php b/includes/api/v1/class-wc-api-orders.php
index c43769f6f8d..ca34c683f49 100755
--- a/includes/api/v1/class-wc-api-orders.php
+++ b/includes/api/v1/class-wc-api-orders.php
@@ -107,7 +107,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( is_wp_error( $id ) )
return $id;
- $order = get_order( $id );
+ $order = wc_get_order( $id );
$order_post = get_post( $id );
@@ -275,7 +275,7 @@ class WC_API_Orders extends WC_API_Resource {
if ( is_wp_error( $id ) )
return $id;
- $order = get_order( $id );
+ $order = wc_get_order( $id );
if ( ! empty( $data['status'] ) ) {
diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php
index d39b8d462a1..d44e066dfd9 100644
--- a/includes/class-wc-ajax.php
+++ b/includes/class-wc-ajax.php
@@ -358,7 +358,7 @@ class WC_AJAX {
die();
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order->update_status( 'completed' );
wp_safe_redirect( wp_get_referer() );
@@ -383,7 +383,7 @@ class WC_AJAX {
die();
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order->update_status( 'processing' );
wp_safe_redirect( wp_get_referer() );
@@ -867,7 +867,7 @@ class WC_AJAX {
$product_ids = $_POST['product_ids'];
$loop = intval( $_POST['loop'] );
$file_counter = 0;
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( ! is_array( $product_ids ) ) {
$product_ids = array( $product_ids );
@@ -956,7 +956,7 @@ class WC_AJAX {
}
$_product = get_product( $post->ID );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order_taxes = $order->get_taxes();
$class = 'new_row';
@@ -1021,7 +1021,7 @@ class WC_AJAX {
check_ajax_referer( 'order-item', 'security' );
$order_id = absint( $_POST['order_id'] );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order_taxes = $order->get_taxes();
$can_be_edited = in_array( $order->get_status(), apply_filters( 'wc_order_can_be_edited', array( 'pending', 'on-hold' ) ) );
$item = array();
@@ -1050,7 +1050,7 @@ class WC_AJAX {
check_ajax_referer( 'order-item', 'security' );
$order_id = absint( $_POST['order_id'] );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order_taxes = $order->get_taxes();
$shipping_methods = WC()->shipping() ? WC()->shipping->load_shipping_methods() : array();
$can_be_edited = in_array( $order->get_status(), apply_filters( 'wc_order_can_be_edited', array( 'pending', 'on-hold' ) ) );
@@ -1142,7 +1142,7 @@ class WC_AJAX {
$order_id = absint( $_POST['order_id'] );
$order_item_ids = isset( $_POST['order_item_ids'] ) ? $_POST['order_item_ids'] : array();
$order_item_qty = isset( $_POST['order_item_qty'] ) ? $_POST['order_item_qty'] : array();
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order_items = $order->get_items();
$return = array();
@@ -1188,7 +1188,7 @@ class WC_AJAX {
$order_id = absint( $_POST['order_id'] );
$order_item_ids = isset( $_POST['order_item_ids'] ) ? $_POST['order_item_ids'] : array();
$order_item_qty = isset( $_POST['order_item_qty'] ) ? $_POST['order_item_qty'] : array();
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$order_items = $order->get_items();
$return = array();
@@ -1271,7 +1271,7 @@ class WC_AJAX {
$state = strtoupper( esc_attr( $_POST['state'] ) );
$postcode = strtoupper( esc_attr( $_POST['postcode'] ) );
$city = sanitize_title( esc_attr( $_POST['city'] ) );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$taxes = array();
$shipping_taxes = array();
@@ -1457,7 +1457,7 @@ class WC_AJAX {
$is_customer_note = $note_type == 'customer' ? 1 : 0;
if ( $post_id > 0 ) {
- $order = get_order( $post_id );
+ $order = wc_get_order( $post_id );
$comment_id = $order->add_order_note( $note, $is_customer_note );
echo '
' . __( 'Go to homepage', 'woocommerce' ) . '', '', array( 'response' => 404 ) );
diff --git a/includes/class-wc-emails.php b/includes/class-wc-emails.php
index 01d0ba5bfc5..4ecb8baf396 100644
--- a/includes/class-wc-emails.php
+++ b/includes/class-wc-emails.php
@@ -412,7 +412,7 @@ class WC_Emails {
else
$title = sprintf(__( 'Product #%s - %s', 'woocommerce' ), $product->id, get_the_title($product->id)) . $sku;
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$message = sprintf(__( '%s units of %s have been backordered in order %s.', 'woocommerce' ), $quantity, $title, $order->get_order_number() );
// CC, BCC, additional headers
diff --git a/includes/class-wc-form-handler.php b/includes/class-wc-form-handler.php
index 74381d023c8..11a60a14be4 100755
--- a/includes/class-wc-form-handler.php
+++ b/includes/class-wc-form-handler.php
@@ -264,7 +264,7 @@ class WC_Form_Handler {
// Pay for existing order
$order_key = $_GET['key'];
$order_id = absint( $wp->query_vars['order-pay'] );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
@@ -462,7 +462,7 @@ class WC_Form_Handler {
WC()->cart->empty_cart();
// Load the previous order - Stop if the order does not exist
- $order = get_order( absint( $_GET['order_again'] ) );
+ $order = wc_get_order( absint( $_GET['order_again'] ) );
if ( empty( $order->id ) ) {
return;
@@ -519,7 +519,7 @@ class WC_Form_Handler {
$order_key = $_GET['order'];
$order_id = absint( $_GET['order_id'] );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$user_can_cancel = current_user_can( 'cancel_order', $order_id );
$order_can_cancel = $order->has_status( apply_filters( 'woocommerce_valid_order_statuses_for_cancel', array( 'pending', 'failed' ) ) );
$redirect = $_GET['redirect'];
diff --git a/includes/emails/class-wc-email-customer-completed-order.php b/includes/emails/class-wc-email-customer-completed-order.php
index ed7aed2a4c1..b4042f27145 100644
--- a/includes/emails/class-wc-email-customer-completed-order.php
+++ b/includes/emails/class-wc-email-customer-completed-order.php
@@ -52,7 +52,7 @@ class WC_Email_Customer_Completed_Order extends WC_Email {
function trigger( $order_id ) {
if ( $order_id ) {
- $this->object = get_order( $order_id );
+ $this->object = wc_get_order( $order_id );
$this->recipient = $this->object->billing_email;
$this->find['order-date'] = '{order_date}';
diff --git a/includes/emails/class-wc-email-customer-invoice.php b/includes/emails/class-wc-email-customer-invoice.php
index 0cecb6fc13b..f46a7ffe729 100644
--- a/includes/emails/class-wc-email-customer-invoice.php
+++ b/includes/emails/class-wc-email-customer-invoice.php
@@ -54,7 +54,7 @@ class WC_Email_Customer_Invoice extends WC_Email {
function trigger( $order ) {
if ( ! is_object( $order ) ) {
- $order = get_order( absint( $order ) );
+ $order = wc_get_order( absint( $order ) );
}
if ( $order ) {
diff --git a/includes/emails/class-wc-email-customer-note.php b/includes/emails/class-wc-email-customer-note.php
index 03e6bc44e63..3edceaa1234 100644
--- a/includes/emails/class-wc-email-customer-note.php
+++ b/includes/emails/class-wc-email-customer-note.php
@@ -63,7 +63,7 @@ class WC_Email_Customer_Note extends WC_Email {
extract( $args );
- $this->object = get_order( $order_id );
+ $this->object = wc_get_order( $order_id );
$this->recipient = $this->object->billing_email;
$this->customer_note = $customer_note;
diff --git a/includes/emails/class-wc-email-customer-processing-order.php b/includes/emails/class-wc-email-customer-processing-order.php
index a648c69c27f..b25f4b71a93 100644
--- a/includes/emails/class-wc-email-customer-processing-order.php
+++ b/includes/emails/class-wc-email-customer-processing-order.php
@@ -49,7 +49,7 @@ class WC_Email_Customer_Processing_Order extends WC_Email {
function trigger( $order_id ) {
if ( $order_id ) {
- $this->object = get_order( $order_id );
+ $this->object = wc_get_order( $order_id );
$this->recipient = $this->object->billing_email;
$this->find['order-date'] = '{order_date}';
diff --git a/includes/emails/class-wc-email-new-order.php b/includes/emails/class-wc-email-new-order.php
index 3c7a62f2c4a..f85678dbd40 100644
--- a/includes/emails/class-wc-email-new-order.php
+++ b/includes/emails/class-wc-email-new-order.php
@@ -59,7 +59,7 @@ class WC_Email_New_Order extends WC_Email {
function trigger( $order_id ) {
if ( $order_id ) {
- $this->object = get_order( $order_id );
+ $this->object = wc_get_order( $order_id );
$this->find['order-date'] = '{order_date}';
$this->find['order-number'] = '{order_number}';
diff --git a/includes/gateways/bacs/class-wc-gateway-bacs.php b/includes/gateways/bacs/class-wc-gateway-bacs.php
index dabeab20fdb..8d05fe5ea99 100644
--- a/includes/gateways/bacs/class-wc-gateway-bacs.php
+++ b/includes/gateways/bacs/class-wc-gateway-bacs.php
@@ -291,7 +291,7 @@ class WC_Gateway_BACS extends WC_Payment_Gateway {
*/
public function process_payment( $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
// Mark as on-hold (we're awaiting the payment)
$order->update_status( 'on-hold', __( 'Awaiting BACS payment', 'woocommerce' ) );
diff --git a/includes/gateways/cheque/class-wc-gateway-cheque.php b/includes/gateways/cheque/class-wc-gateway-cheque.php
index 09069506e6f..049778b1da9 100755
--- a/includes/gateways/cheque/class-wc-gateway-cheque.php
+++ b/includes/gateways/cheque/class-wc-gateway-cheque.php
@@ -108,7 +108,7 @@ class WC_Gateway_Cheque extends WC_Payment_Gateway {
*/
public function process_payment( $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
// Mark as on-hold (we're awaiting the cheque)
$order->update_status( 'on-hold', __( 'Awaiting cheque payment', 'woocommerce' ) );
diff --git a/includes/gateways/cod/class-wc-gateway-cod.php b/includes/gateways/cod/class-wc-gateway-cod.php
index 389d9f28f3e..b72e58b8cb2 100644
--- a/includes/gateways/cod/class-wc-gateway-cod.php
+++ b/includes/gateways/cod/class-wc-gateway-cod.php
@@ -120,7 +120,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
if ( is_page( wc_get_page_id( 'checkout' ) ) && 0 < get_query_var( 'order-pay' ) ) {
$order_id = absint( get_query_var( 'order-pay' ) );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
// Test if order needs shipping.
$needs_shipping = false;
@@ -198,7 +198,7 @@ class WC_Gateway_COD extends WC_Payment_Gateway {
*/
public function process_payment( $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
// Mark as processing (payment won't be taken until delivery)
$order->update_status( 'processing', __( 'Payment to be made upon delivery.', 'woocommerce' ) );
diff --git a/includes/gateways/mijireh/class-wc-gateway-mijireh.php b/includes/gateways/mijireh/class-wc-gateway-mijireh.php
index 10f3a5665fd..b894bcdd2aa 100644
--- a/includes/gateways/mijireh/class-wc-gateway-mijireh.php
+++ b/includes/gateways/mijireh/class-wc-gateway-mijireh.php
@@ -90,7 +90,7 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway {
try {
$mj_order = new Mijireh_Order( esc_attr( $_GET['order_number'] ) );
$wc_order_id = $mj_order->get_meta_value( 'wc_order_id' );
- $wc_order = get_order( absint( $wc_order_id ) );
+ $wc_order = wc_get_order( absint( $wc_order_id ) );
// Mark order complete
$wc_order->payment_complete();
@@ -162,7 +162,7 @@ class WC_Gateway_Mijireh extends WC_Payment_Gateway {
$this->init_mijireh();
$mj_order = new Mijireh_Order();
- $wc_order = get_order( $order_id );
+ $wc_order = wc_get_order( $order_id );
// Avoid rounding issues altogether by sending the order as one lump
if ( get_option( 'woocommerce_prices_include_tax' ) == 'yes' ) {
diff --git a/includes/gateways/paypal/class-wc-gateway-paypal.php b/includes/gateways/paypal/class-wc-gateway-paypal.php
index 2475485fc5e..ecf223c8dc6 100644
--- a/includes/gateways/paypal/class-wc-gateway-paypal.php
+++ b/includes/gateways/paypal/class-wc-gateway-paypal.php
@@ -486,7 +486,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
*/
public function generate_paypal_form( $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( 'yes' == $this->testmode ) {
$paypal_adr = $this->testurl . '?test_ipn=1&';
@@ -545,7 +545,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
* @return array
*/
public function process_payment( $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$paypal_args = $this->get_paypal_args( $order );
$paypal_args = http_build_query( $paypal_args, '', '&' );
@@ -569,7 +569,7 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
* @return bool|wp_error True or false based on success, or a WP_Error object
*/
public function process_refund( $order_id, $amount = null, $reason = '' ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( ! $order || ! $order->get_transaction_id() || ! $this->api_username || ! $this->api_password || ! $this->api_password ) {
return false;
@@ -996,12 +996,12 @@ class WC_Gateway_Paypal extends WC_Payment_Gateway {
list( $order_id, $order_key ) = $custom;
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( ! isset( $order->id ) ) {
// We have an invalid $order_id, probably because invoice_prefix has changed
$order_id = wc_get_order_id_by_order_key( $order_key );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
}
// Validate key
diff --git a/includes/shortcodes/class-wc-shortcode-checkout.php b/includes/shortcodes/class-wc-shortcode-checkout.php
index b09185dcc52..ce2feab3d54 100644
--- a/includes/shortcodes/class-wc-shortcode-checkout.php
+++ b/includes/shortcodes/class-wc-shortcode-checkout.php
@@ -44,7 +44,7 @@ class WC_Shortcode_Checkout {
// Get the order to work out what we are showing
$order_id = absint( $_GET['order'] );
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( $order->has_status( 'pending' ) ) {
$wp->query_vars['order-pay'] = absint( $_GET['order'] );
@@ -85,7 +85,7 @@ class WC_Shortcode_Checkout {
// Pay for existing order
$order_key = $_GET[ 'key' ];
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
if ( ! current_user_can( 'pay_for_order', $order_id ) ) {
@@ -119,7 +119,7 @@ class WC_Shortcode_Checkout {
// Pay for order after checkout step
$order_key = isset( $_GET['key'] ) ? wc_clean( $_GET['key'] ) : '';
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
$valid_order_statuses = apply_filters( 'woocommerce_valid_order_statuses_for_payment', array( 'pending', 'failed' ), $order );
if ( $order->id == $order_id && $order->order_key == $order_key ) {
@@ -186,7 +186,7 @@ class WC_Shortcode_Checkout {
$order_key = apply_filters( 'woocommerce_thankyou_order_key', empty( $_GET['key'] ) ? '' : wc_clean( $_GET['key'] ) );
if ( $order_id > 0 ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( $order->order_key != $order_key )
unset( $order );
}
diff --git a/includes/shortcodes/class-wc-shortcode-my-account.php b/includes/shortcodes/class-wc-shortcode-my-account.php
index e8ca858d381..14b8860d989 100644
--- a/includes/shortcodes/class-wc-shortcode-my-account.php
+++ b/includes/shortcodes/class-wc-shortcode-my-account.php
@@ -105,7 +105,7 @@ class WC_Shortcode_My_Account {
private static function view_order( $order_id ) {
$user_id = get_current_user_id();
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( ! current_user_can( 'view_order', $order_id ) ) {
echo '';
@@ -118,7 +118,7 @@ class WC_Shortcode_My_Account {
wc_get_template( 'myaccount/view-order.php', array(
'status' => $status, // @deprecated 2.2
- 'order' => get_order( $order_id ),
+ 'order' => wc_get_order( $order_id ),
'order_id' => $order_id
) );
}
diff --git a/includes/shortcodes/class-wc-shortcode-order-tracking.php b/includes/shortcodes/class-wc-shortcode-order-tracking.php
index ff91de416fb..17a17a6e343 100644
--- a/includes/shortcodes/class-wc-shortcode-order-tracking.php
+++ b/includes/shortcodes/class-wc-shortcode-order-tracking.php
@@ -59,7 +59,7 @@ class WC_Shortcode_Order_Tracking {
} else {
- $order = get_order( apply_filters( 'woocommerce_shortcode_order_tracking_order_id', $order_id ) );
+ $order = wc_get_order( apply_filters( 'woocommerce_shortcode_order_tracking_order_id', $order_id ) );
if ( $order->id && $order_email ) {
diff --git a/includes/wc-cart-functions.php b/includes/wc-cart-functions.php
index f877d6cae92..0c873c35563 100644
--- a/includes/wc-cart-functions.php
+++ b/includes/wc-cart-functions.php
@@ -119,7 +119,7 @@ function wc_clear_cart_after_payment() {
$order_key = '';
if ( $order_id > 0 ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( $order->order_key == $order_key ) {
WC()->cart->empty_cart();
@@ -130,7 +130,7 @@ function wc_clear_cart_after_payment() {
if ( WC()->session->order_awaiting_payment > 0 ) {
- $order = get_order( WC()->session->order_awaiting_payment );
+ $order = wc_get_order( WC()->session->order_awaiting_payment );
if ( $order->id > 0 ) {
// If the order has not failed, or is not pending, the order must have gone through
diff --git a/includes/wc-order-functions.php b/includes/wc-order-functions.php
index 49f2027879b..3606aafd2b1 100644
--- a/includes/wc-order-functions.php
+++ b/includes/wc-order-functions.php
@@ -38,7 +38,7 @@ function wc_get_order_statuses() {
* @param array $args (default: array()) Contains all arguments to be used to get this order.
* @return WC_Order
*/
-function get_order( $the_order = false, $args = array() ) {
+function wc_get_order( $the_order = false, $args = array() ) {
return WC()->order_factory->get_order( $the_order, $args );
}
@@ -272,7 +272,7 @@ function wc_downloadable_product_permissions( $order_id ) {
return; // Only do this once
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( $order->has_status( 'processing' ) && get_option( 'woocommerce_downloads_grant_access_after_payment' ) == 'no' ) {
return;
@@ -471,7 +471,7 @@ function wc_cancel_unpaid_orders() {
if ( $unpaid_orders ) {
foreach ( $unpaid_orders as $unpaid_order ) {
- $order = get_order( $unpaid_order );
+ $order = wc_get_order( $unpaid_order );
if ( apply_filters( 'woocommerce_cancel_unpaid_order', true, $order ) )
$order->update_status( 'cancelled', __( 'Unpaid order cancelled - time limit reached.', 'woocommerce' ) );
@@ -592,9 +592,9 @@ function wc_create_refund( $args = array() ) {
// Negative line items
if ( sizeof( $args['line_items'] ) > 0 ) {
- $order = get_order( $args['order_id'] );
+ $order = wc_get_order( $args['order_id'] );
$order_items = $order->get_items( array( 'line_item', 'fee', 'shipping' ) );
- $refund = get_order( $refund_id );
+ $refund = wc_get_order( $refund_id );
foreach ( $args['line_items'] as $refund_item_id => $refund_item ) {
if ( isset( $order_items[ $refund_item_id ] ) ) {
diff --git a/includes/wc-user-functions.php b/includes/wc-user-functions.php
index 1dfadd20dae..37d20d7d623 100644
--- a/includes/wc-user-functions.php
+++ b/includes/wc-user-functions.php
@@ -198,7 +198,7 @@ function wc_update_new_customer_past_orders( $customer_id ) {
*/
function wc_paying_customer( $order_id ) {
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( $order->user_id > 0 ) {
update_user_meta( $order->user_id, 'paying_customer', 1 );
@@ -278,7 +278,7 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
switch ( $caps[0] ) {
case 'view_order' :
$user_id = $args[1];
- $order = get_order( $args[2] );
+ $order = wc_get_order( $args[2] );
if ( $user_id == $order->user_id ) {
$allcaps['view_order'] = true;
@@ -295,14 +295,14 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
break;
}
- $order = get_order( $order_id );
+ $order = wc_get_order( $order_id );
if ( $user_id == $order->user_id || empty( $order->user_id ) ) {
$allcaps['pay_for_order'] = true;
}
break;
case 'order_again' :
$user_id = $args[1];
- $order = get_order( $args[2] );
+ $order = wc_get_order( $args[2] );
if ( $user_id == $order->user_id ) {
$allcaps['order_again'] = true;
@@ -310,7 +310,7 @@ function wc_customer_has_capability( $allcaps, $caps, $args ) {
break;
case 'cancel_order' :
$user_id = $args[1];
- $order = get_order( $args[2] );
+ $order = wc_get_order( $args[2] );
if ( $user_id == $order->user_id ) {
$allcaps['cancel_order'] = true;
@@ -418,7 +418,7 @@ function wc_get_customer_available_downloads( $customer_id ) {
foreach ( $results as $result ) {
if ( ! $order || $order->id != $result->order_id ) {
// new order
- $order = get_order( $result->order_id );
+ $order = wc_get_order( $result->order_id );
$_product = null;
}
diff --git a/templates/myaccount/my-orders.php b/templates/myaccount/my-orders.php
index cfff4e95ac8..463907777c3 100644
--- a/templates/myaccount/my-orders.php
+++ b/templates/myaccount/my-orders.php
@@ -39,7 +39,7 @@ if ( $customer_orders ) : ?>
populate( $customer_order );
$item_count = $order->get_item_count();
diff --git a/templates/order/order-details.php b/templates/order/order-details.php
index f218e83f365..9f53ce94b68 100755
--- a/templates/order/order-details.php
+++ b/templates/order/order-details.php
@@ -11,7 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
global $woocommerce;
-$order = get_order( $order_id );
+$order = wc_get_order( $order_id );
?>