本文整理汇总了PHP中WC_Order::get_status方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order::get_status方法的具体用法?PHP WC_Order::get_status怎么用?PHP WC_Order::get_status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WC_Order
的用法示例。
在下文中一共展示了WC_Order::get_status方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: custom_order_actions
/**
* Add custom order actions in order list view
*
* @since 1.0.0
* @param array $actions
* @param \WC_Order $order
* @return array
*/
public function custom_order_actions($actions, WC_Order $order)
{
$status = new WC_Order_Status_Manager_Order_Status($order->get_status());
// Sanity check: bail if no status was found.
// This can happen if some statuses are registered late
if (!$status || !$status->get_id()) {
return $actions;
}
$next_statuses = $status->get_next_statuses();
$order_statuses = wc_get_order_statuses();
$custom_actions = array();
// TODO: Change action to `woocommerce_mark_order_status` for 2.3.x compatibility
// TODO: Change nonce_action to `woocommerce-mark-order-status` for 2.3.x compatibility
$action = 'wc_order_status_manager_mark_order_status';
$nonce_action = 'wc-order-status-manager-mark-order-status';
// Add next statuses as actions
if (!empty($next_statuses)) {
foreach ($next_statuses as $next_status) {
$custom_actions[$next_status] = array('url' => wp_nonce_url(admin_url('admin-ajax.php?action=' . $action . '&status=' . $next_status . '&order_id=' . $order->id), $nonce_action), 'name' => $order_statuses['wc-' . $next_status], 'action' => $next_status);
// Remove duplicate built-in complete action
if ('completed' === $next_status) {
unset($actions['complete']);
}
}
}
// Next status actions are prepended to any existing actions
return $custom_actions + $actions;
}
示例2: add_meta_boxes
public function add_meta_boxes()
{
global $post;
if (isset($_GET['post'])) {
if (get_post_meta($_GET['post'], '_payment_method', true) == 'inicis_escrow_bank') {
$payment_method = get_post_meta($_GET['post'], '_payment_method', true);
$tmp_settings = get_option('woocommerce_' . $payment_method . '_settings', true);
$refund_mypage_status = $tmp_settings['possible_register_delivery_info_status_for_admin'];
//관리자 배송정보 등록/환불 가능 주문상태 지정
$order = new WC_Order($post->ID);
$paid_order = get_post_meta($post->ID, "_paid_date", true);
if (in_array($order->get_status(), $refund_mypage_status) && !empty($paid_order)) {
add_meta_box('ifw-order-escrow-register-delivery-request', __('이니시스 에스크로', 'codem_inicis'), 'IFW_Meta_Box_Escrow_Register_Delivery::output', 'shop_order', 'side', 'default');
}
} else {
if (get_post_meta($_GET['post'], '_payment_method', true) == 'inicis_vbank') {
add_meta_box('ifw-order-vbank-refund-request', __('가상계좌 무통장입금 환불 처리', 'codem_inicis'), 'IFW_Meta_Box_Vbank_Refund::output', 'shop_order', 'side', 'default');
} else {
if (in_array(get_post_meta($_GET['post'], '_payment_method', true), array('inicis_card', 'inicis_bank', 'inicis_hpp', 'inicis_kpay', 'inicis_stdcard'))) {
$order = new WC_Order($_GET['post']);
if (!in_array($order->get_status(), array('pending', 'on-hold'))) {
add_meta_box('ifw-order-refund-request', __('결제내역', 'codem_inicis'), 'IFW_Meta_Box_Refund::output', 'shop_order', 'side', 'default');
}
}
}
}
}
}
示例3: is_paid
/**
* Checks if order is paid
* @return bool
*/
public function is_paid()
{
$payment_methods = apply_filters('bewpi_paid_watermark_excluded_payment_methods', array('bacs', 'cod', 'cheque'), $this->order->id);
if (in_array($this->order->payment_method, $payment_methods)) {
return false;
}
$order_statuses = apply_filters('bewpi_paid_watermark_excluded_order_statuses', array('pending', 'on-hold', 'auto-draft'), $this->order->id);
return !in_array($this->order->get_status(), $order_statuses);
}
示例4: thankyou_page
/**
* Output for the order received page.
*/
public function thankyou_page($order_id)
{
$order = new WC_Order($order_id);
if ('completed' == $order->get_status()) {
echo '<p>' . __('Your booking has been confirmed. Thank you.', 'woocommerce-bookings') . '</p>';
} else {
echo '<p>' . __('Your booking is awaiting confirmation. You will be notified by email as soon as we\'ve confirmed availability.', 'woocommerce-bookings') . '</p>';
}
}
示例5: wps_wcc_new_order
function wps_wcc_new_order($order_id)
{
global $sms, $wps_options;
$order = new WC_Order($order_id);
if (!$get_mobile) {
return;
}
$sms->to = array(get_option('wp_admin_mobile'));
$string = $wps_options['wpsms_wc_no_tt'];
$template_vars = array('order_id' => $order_id, 'status' => $order->get_status(), 'order_name' => $order->get_order_number());
$final_message = preg_replace('/%(.*?)%/ime', "\$template_vars['\$1']", $string);
$sms->msg = $final_message;
$sms->SendSMS();
}
示例6: date
function thankyou_page($order_id)
{
if (empty($order_id)) {
return;
}
$order = new WC_Order($order_id);
if ($order->payment_method != 'inicis_vbank' || $order->get_status() == 'failed') {
return;
}
$VACT_BankCodeName = get_post_meta($order_id, 'VACT_BankCodeName', true);
//입금은행명/코드
$VACT_Num = get_post_meta($order_id, 'VACT_Num', true);
//계좌번호
$VACT_Name = get_post_meta($order_id, 'VACT_Name', true);
//예금주
$VACT_InputName = get_post_meta($order_id, 'VACT_InputName', true);
//송금자
$VACT_Date = get_post_meta($order_id, 'VACT_Date', true);
//입금예정일
$vact_date_format = date(__('Y년 m월 d일', 'inicis_payment'), strtotime($VACT_Date));
echo '<h2>' . __('가상계좌 무통장입금 안내', 'inicis_payment') . '</h2>';
echo '<p>' . __('가상계좌 무통장입금 안내로 주문이 접수되었습니다. 아래 지정된 계좌번호로 입금기한내에 반드시 입금하셔야 하며, 송금자명으로 입금 해주셔야 주문이 정상 접수 됩니다.', 'inicis_payment') . '</p>';
echo '
<table name="inicis_vbank_account_table" id="inicis_vbank_account_table" class="inicis_vbank_account_table">
<tbody>';
echo '<tr>';
echo ' <th>' . __('은행명:', 'inicis_payment') . '</th>';
echo ' <td data-title="' . __('은행명:', 'inicis_payment') . '">' . $VACT_BankCodeName . '</td>';
echo '</tr>';
echo '<tr>';
echo ' <th>' . __('계좌번호:', 'inicis_payment') . '</th>';
echo ' <td data-title="' . __('계좌번호:', 'inicis_payment') . '">' . $VACT_Num . '</td>';
echo '</tr>';
echo '<tr>';
echo ' <th>' . __('예금주:', 'inicis_payment') . '</th>';
echo ' <td data-title="' . __('예금주:', 'inicis_payment') . '">' . $VACT_Name . '</td>';
echo '</tr>';
echo '<tr>';
echo ' <th>' . __('송금자:', 'inicis_payment') . '</th>';
echo ' <td data-title="' . __('송금자:', 'inicis_payment') . '">' . $VACT_InputName . '</td>';
echo '</tr>';
echo '<tr>';
echo ' <th>' . __('입금기한:', 'inicis_payment') . '</th>';
echo ' <td data-title="' . __('입금기한:', 'inicis_payment') . '">' . $vact_date_format . '</td>';
echo '</tr>';
echo '</tbody></table>';
}
示例7: woogiving_process_donation
function woogiving_process_donation()
{
// Setup post variables
$wg_order_id = $_POST['wg_order_id'];
$jg_donation_id = $_POST['jg_donation_id'];
if (is_numeric($wg_order_id) && ctype_alnum($jg_donation_id)) {
// Validate order ID
$wg_order_id_validation = get_post((int) $wg_order_id);
if ($wg_order_id_validation) {
// Get options
$wg_options = get_option('woocommerce_woogiving_settings');
// Include JG API and setup API
require_once 'inc/JustGivingClient.php';
$jg_client = new JustGivingClient('https://api.justgiving.com/', $wg_options['app_id'], 1, $wg_options['api_login'], $wg_options['api_password']);
// Check if donation exists in JG
$wg_donation_id_check = $jg_client->Donation->RetrieveRef(woogiving_create_ref($wg_order_id_validation->ID));
if (count($wg_donation_id_check->donations)) {
// Check if donations IDs match
if ($wg_donation_id_check->donations[0]->id == (int) $jg_donation_id) {
// Get donation details from JG
$wg_donation_id_status = $jg_client->Donation->RetrieveStatus($jg_donation_id);
$jg_amount = $wg_donation_id_status->amount;
$jg_status = $wg_donation_id_status->status;
// Get customer order
$customer_order = new WC_Order($wg_order_id_validation->ID);
// Check if amount donated is equal to higher than the amount in the order
if ($jg_amount >= $customer_order->order_total && $jg_status == 'Accepted') {
// Get JG fundraising page ID
$wg_jg_page_check = $jg_client->Page->Retrieve($wg_options['username']);
// Check if donation was made to correct charity
if ($wg_jg_page_check->charity->id == $wg_donation_id_check->donations[0]->charityId) {
// Check order status
if ($customer_order->get_status() == 'completed') {
// Order has already been completed
return json_encode(array('wg_status' => 'failure', 'wg_message' => __('This donation has already been processed.', 'woogiving')));
} else {
// Reduce stock levels and complete payment
$customer_order->reduce_order_stock();
$customer_order->payment_complete($jg_donation_id);
$customer_order->update_status('completed');
return json_encode(array('wg_status' => 'success', 'wg_redirect' => woogiving_get_return_url($customer_order)));
}
} else {
return json_encode(array('wg_status' => 'failure', 'wg_message' => __('This donation cannot be processed, please contact us.', 'woogiving')));
}
}
} else {
return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Invalid donation ID.', 'woogiving')));
}
} else {
return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Invalid donation ID.', 'woogiving')));
}
} else {
return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Donation could not be processed.', 'woogiving')));
}
} else {
return json_encode(array('wg_status' => 'failure', 'wg_message' => __('Donation could not be processed.', 'woogiving')));
}
}
示例8: get_order_status
/**
* The the Order's status
* @param WC_Order $order
* @return string
*/
public static function get_order_status(WC_Order $order)
{
if (self::is_wc_version_gte_2_2()) {
return $order->get_status();
} else {
return $order->status;
}
}
示例9: explode
function successful_request_mobile_return($posted)
{
global $woocommerce;
if ($this->id == 'inicis_bank' && wp_is_mobile()) {
$get_type = $_GET['type'];
$tmp_rst = explode(',', $get_type);
$tmp_oid = $tmp_rst[1];
$tmp_rst = explode('=', $tmp_oid);
$oid = $tmp_rst[1];
$tmp_rst = explode('_', $oid);
$orderid = $tmp_rst[0];
$order = new WC_Order($orderid);
if (in_array($order->get_status(), array('pending', 'failed'))) {
wc_add_notice(__('결제를 취소하셨습니다. (ERROR: 0xF53D)', 'inicis_payment'), 'error');
wp_redirect(WC()->cart->get_checkout_url());
exit;
}
}
}
示例10:
/**
* Test: update_status
*/
function test_update_status()
{
$object = new WC_Order();
$this->assertFalse($object->update_status('on-hold'));
$object->save();
$this->assertTrue($object->update_status('on-hold'));
$this->assertEquals('on-hold', $object->get_status());
}
示例11: getOrderStatusFromPlex
<?php
require_once 'request.php';
require_once 'ResponseHandler.php';
require_once 'PlexDataSourceKey.php';
wp_head();
$args = array('posts_per_page' => -1, 'post_type' => 'shop_order', 'post_status' => 'publish');
$starting_time = microtime(true);
$orders = new WP_Query($args);
$inc = 0;
if ($orders->have_posts()) {
while ($orders->have_posts()) {
$orders->the_post();
$order = new WC_Order($post->ID);
if ('processing' == $order->get_status()) {
echo '<br>';
$inc++;
$plexOrderId = get_post_meta($post->ID, 'plexOrderId', true);
if ('' != $plexOrderId) {
$orderStatus = getOrderStatusFromPlex($plexOrderId);
echo 'orderStatus for plex order id=' . $plexOrderId . ' is = ' . $orderStatus;
}
echo '<br>';
} else {
}
}
}
$end_time = microtime(true);
/* This function will return the status string */
function getOrderStatusFromPlex($plexOrderId)
{
示例12: array
function do_background_checks($explicit = false)
{
$statuses = array();
$min_age = $this->pending_order_check_min_age;
if ($explicit == true) {
$min_age = 0;
}
$orders = $this->get_pending_orders($min_age);
if ('yes' == $this->debug) {
$c_orders = 0;
if ($orders) {
$c_orders = count($orders);
}
$this->log->add($this->id, "do_background_checks: #orders=" . $c_orders);
}
if ($orders) {
foreach ($orders as $ordera) {
$order_id = $ordera->order_id;
$order = new WC_Order($order_id);
/*if (!$order->needs_payment()) {
if ( 'yes' == $this->debug )
$this->log->add($this->id, " order: #".$order->id . " (".$order->get_status().") does not need payment. removing from the queue.");
$this->remove_from_maksuturva_queue($ordera->order_id, $ordera->payment_id);
continue;
}*/
if ('yes' == $this->debug) {
$this->log->add($this->id, " process status_query for order: #" . $order->id . " (" . $order->get_status() . ") ");
}
$response = $this->status_request($order);
$status = $response['status'];
if ($response['status'] === 'false') {
if ($response['exception'] == 'true') {
if ('yes' == $this->debug) {
$this->log->add($this->id, " Error: " . $response['response']);
}
$statuses[] = array('id' => $order->id, 'message' => __('Error:', $this->td) . ": " . $response['response']);
} else {
$statuses[] = array('id' => $order->id, 'message' => __('Error: order not found on Maksuturva', $this->td) . ": " . $response['response']);
if ('yes' == $this->debug) {
$this->log->add($this->id, " order #" . $order->id . " not found. Removing from the queue...");
}
$this->remove_from_maksuturva_queue($ordera->order_id, $ordera->payment_id);
$order->cancel_order();
}
continue;
}
if ('yes' == $this->debug) {
$this->log->add($this->id, " process_status_query_result");
}
$res = $this->process_status_query_result($order, $response['response'], $ordera);
if ($order->needs_payment()) {
$statuses[] = $res;
}
}
}
return $statuses;
}
示例13: get_history
/**
* @param array $qs
*
* @return array
*/
public static function get_history($qs)
{
$orders = array();
foreach ($qs as $item => $values) {
$order = new WC_Order($qs[$item]->ID);
$orderDate = new DateTime($order->order_date);
$orders[] = array('id' => (string) $order->id, 'amount' => Aplazame_Filters::decimals($order->get_total()), 'due' => '', 'status' => $order->get_status(), 'type' => Aplazame_Helpers::get_payment_method($order->id), 'order_date' => $orderDate->format(DATE_ISO8601), 'currency' => $order->get_order_currency(), 'billing' => self::get_address($order, 'billing'), 'shipping' => self::get_shipping_info($order));
}
return $orders;
}
示例14: isset
/**
* @param WC_Order $wc_order
*/
static function send_booking($wc_order)
{
$order = new Bring_WC_Order_Adapter($wc_order);
$order_id = $wc_order->id;
$test_mode = self::is_test_mode();
$api_key = self::get_api_key();
$api_uid = self::get_api_uid();
$client_url = self::get_client_url();
$customer_number = isset($_REQUEST['_bring-customer-number']) ? $_REQUEST['_bring-customer-number'] : '';
if (isset($_REQUEST['_bring-shipping-date']) && isset($_REQUEST['_bring-shipping-date-hour']) && isset($_REQUEST['_bring-shipping-date-minutes'])) {
$shipping_date_time = $_REQUEST['_bring-shipping-date'] . 'T' . $_REQUEST['_bring-shipping-date-hour'] . ':' . $_REQUEST['_bring-shipping-date-minutes'] . ':00';
} else {
$shipping_date = self::create_shipping_date();
$shipping_date_time = $shipping_date['date'] . "T" . $shipping_date['hour'] . ":" . $shipping_date['minute'] . ":00";
}
$additional_info = '';
if (isset($_REQUEST['_bring_additional_info'])) {
$additional_info = filter_var($_REQUEST['_bring_additional_info'], FILTER_SANITIZE_STRING);
}
$sender_address = self::get_sender_address($additional_info);
$recipient_address = $order->get_recipient_address_formatted();
// One booking request per. order shipping item.
foreach ($order->get_fraktguiden_shipping_items() as $item_id => $shipping_method) {
$service_id = Fraktguiden_Helper::parse_shipping_method_id($shipping_method['method_id'])['service'];
$packages = $order->get_packages_formatted($item_id);
$pickup_point = $order->get_pickup_point_for_shipping_item_formatted($item_id);
$booking_request = new Bring_Booking_Request(new WP_Bring_Request());
$booking_request->set_test_mode($test_mode)->set_content_type('application/json')->set_accept('application/json')->set_api_key($api_key)->set_api_uid($api_uid)->set_client_url($client_url);
$consignment = new Bring_Booking_Consignment_Creator();
$consignment->set_purchase_order($order_id)->set_shipping_date_time($shipping_date_time)->set_sender_address($sender_address)->set_recipient_address($recipient_address)->set_product_id($service_id)->set_customer_number($customer_number)->set_packages($packages);
if (!empty($pickup_point)) {
$consignment->set_pickup_point($pickup_point);
}
if (Fraktguiden_Helper::get_option('evarsling') == 'yes') {
$product_services = ['recipientNotification' => ['email' => $recipient_address['contact']['email'], 'mobile' => $recipient_address['contact']['phoneNumber']]];
$consignment->set_product_services($product_services);
}
$booking_request->add_consignment_data($consignment->create_data());
// Start sending the booking
if ($booking_request->is_valid()) {
$original_order_status = $wc_order->get_status();
// Set order status to awaiting shipping.
$wc_order->update_status('wc-bring-shipment');
// Send the booking.
$response = $booking_request->send();
// Save the response json to the order.
$order->update_booking_response($response);
// Download labels pdf
if (!$order->has_booking_errors()) {
Bring_Booking_Labels::download_to_local($order);
}
// Create new status and order note.
if (!$order->has_booking_errors()) {
// Check if the plugin has been configured to set a specific order status after success.
$status = Fraktguiden_Helper::get_option('auto_set_status_after_booking_success');
if ($status == 'none') {
// Set status back to the previous status
$status = $original_order_status;
}
$status_note = __("Booked with Bring" . "\n", 'bring-fraktguiden');
} else {
// If there are errors, set the status back to the original status.
$status = $original_order_status;
$status_note = __("Booking errors. See the Bring Booking box for details." . "\n", 'bring-fraktguiden');
}
// Update status.
$wc_order->update_status($status, $status_note);
} else {
// @todo: Not valid. show message?
}
}
}
示例15: order_delivery
public function order_delivery($order_id = 0)
{
if (!$order_id || !$this->settings['pickup_location'] || !$this->settings['pickup_name'] || !$this->settings['pickup_phone']) {
return false;
}
// Get order object
$order = new WC_Order($order_id);
if (!$order) {
return false;
}
// Get customer user ID
$user = $order->get_user();
if (!$user) {
return false;
}
$delivery_address = str_replace('<br/>', ', ', $order->get_formatted_shipping_address());
if (!$delivery_address) {
return false;
}
if (!$order->billing_phone) {
return false;
}
$delivery_address_data = $this->get_address_data($delivery_address);
$args = array('pickup_address' => (string) $this->settings['pickup_location'], 'pickup_contact_name' => (string) $this->settings['pickup_name'], 'pickup_contact_phone' => (string) $this->settings['pickup_phone'], 'customer_identifier' => (string) $user->user_login, 'dropoff_contact_name' => (string) $user->display_name, 'dropoff_contact_phone' => (string) $order->billing_phone, 'dropoff_address' => (string) $delivery_address_data['address'], 'dropoff_coordinates' => (string) $delivery_address_data['location']);
if ($this->settings['pickup_coords']) {
$args['pickup_coordinates'] = (string) $this->settings['pickup_coords'];
}
if ($this->settings['pickup_remarks']) {
$args['pickup_remarks'] = (string) $this->settings['pickup_remarks'];
}
if ($this->settings['city']) {
$args['city'] = (string) $this->settings['city'];
}
$delivery_notes = $order->customer_note;
if ($delivery_notes) {
$args['dropoff_remarks'] = (string) $this->settings['delivery_notes'];
}
$delivery = $this->api('deliveries', $args, 'post');
if ($delivery && isset($delivery->id)) {
update_post_meta($order_id, '_wumdrop_delivery_id', $delivery->id);
if (isset($delivery->distance_estimate)) {
update_post_meta($order_id, '_wumdrop_distance_estimate', $delivery->distance_estimate);
}
if (isset($delivery->time_estimate)) {
update_post_meta($order_id, '_wumdrop_time_estimate', $delivery->time_estimate);
}
if (isset($delivery->message)) {
update_post_meta($order_id, '_wumdrop_delivery_message', $delivery->message);
}
if (isset($delivery->time_estimate)) {
update_post_meta($order_id, '_wumdrop_delivery_price', $delivery->price);
}
$order_note = __('WumDrop delivery order placed.', 'woocommerce-wumdrop');
if ('completed' != $order->get_status()) {
$order->update_status('completed', $order_note);
} else {
$order->add_order_note($order_note);
}
return true;
}
return false;
}