Merge pull request #6037 from barrykooij/refactor/wc_get_order
Refactor/wc get order
This commit is contained in:
commit
1965c2b786
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'] ) ) {
|
||||
|
|
|
@ -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'] );
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 '<a href="' . admin_url( 'post.php?post=' . $order->id . '&action=edit' ) . '">' . $order->get_order_number() . '</a> – ' . date_i18n( get_option( 'date_format' ), strtotime( $order->order_date ) );
|
||||
} else echo '-';
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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'] ) ) {
|
||||
|
||||
|
|
|
@ -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 '<li rel="' . esc_attr( $comment_id ) . '" class="note ';
|
||||
|
@ -1817,7 +1817,7 @@ class WC_AJAX {
|
|||
|
||||
try {
|
||||
// Validate that the refund can occur
|
||||
$order = get_order( $order_id );
|
||||
$order = wc_get_order( $order_id );
|
||||
$order_items = $order->get_items();
|
||||
$max_refund = $order->get_total() - $order->get_total_refunded();
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ class WC_Checkout {
|
|||
$order_id = absint( WC()->session->order_awaiting_payment );
|
||||
|
||||
// Resume the unpaid order if its pending
|
||||
if ( $order_id > 0 && ( $order = get_order( $order_id ) ) && $order->has_status( array( 'pending', 'failed' ) ) ) {
|
||||
if ( $order_id > 0 && ( $order = wc_get_order( $order_id ) ) && $order->has_status( array( 'pending', 'failed' ) ) ) {
|
||||
|
||||
$order_data['order_id'] = $order_id;
|
||||
$order = wc_update_order( $order_data );
|
||||
|
@ -630,7 +630,7 @@ class WC_Checkout {
|
|||
} else {
|
||||
|
||||
if ( empty( $order ) )
|
||||
$order = get_order( $order_id );
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
// No payment was required for order
|
||||
$order->payment_complete();
|
||||
|
|
|
@ -89,7 +89,7 @@ class WC_Download_Handler {
|
|||
}
|
||||
|
||||
if ( $order_id ) {
|
||||
$order = get_order( $order_id );
|
||||
$order = wc_get_order( $order_id );
|
||||
|
||||
if ( ! $order->is_download_permitted() || $order->post_status != 'wc-completed' ) {
|
||||
wp_die( __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . esc_url( home_url() ) . '" class="wc-forward">' . __( 'Go to homepage', 'woocommerce' ) . '</a>', '', array( 'response' => 404 ) );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'];
|
||||
|
|
|
@ -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}';
|
||||
|
|
|
@ -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 ) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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}';
|
||||
|
|
|
@ -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}';
|
||||
|
|
|
@ -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' ) );
|
||||
|
|
|
@ -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' ) );
|
||||
|
|
|
@ -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' ) );
|
||||
|
|
|
@ -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' ) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
@ -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 '<div class="woocommerce-error">' . __( 'Invalid order.', 'woocommerce' ) . ' <a href="' . get_permalink( wc_get_page_id( 'myaccount' ) ).'" class="wc-forward">'. __( 'My Account', 'woocommerce' ) .'</a>' . '</div>';
|
||||
|
@ -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
|
||||
) );
|
||||
}
|
||||
|
|
|
@ -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 ) {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ] ) ) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ if ( $customer_orders ) : ?>
|
|||
|
||||
<tbody><?php
|
||||
foreach ( $customer_orders as $customer_order ) {
|
||||
$order = get_order();
|
||||
$order = wc_get_order();
|
||||
$order->populate( $customer_order );
|
||||
$item_count = $order->get_item_count();
|
||||
|
||||
|
|
|
@ -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 );
|
||||
?>
|
||||
<h2><?php _e( 'Order Details', 'woocommerce' ); ?></h2>
|
||||
<table class="shop_table order_details">
|
||||
|
|
Loading…
Reference in New Issue