当前位置: 首页>>代码示例>>PHP>>正文


PHP wc_get_order_item_meta函数代码示例

本文整理汇总了PHP中wc_get_order_item_meta函数的典型用法代码示例。如果您正苦于以下问题:PHP wc_get_order_item_meta函数的具体用法?PHP wc_get_order_item_meta怎么用?PHP wc_get_order_item_meta使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wc_get_order_item_meta函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: set

 function set($item_id, $values, $cart_item_key)
 {
     global $wpdb;
     global $DOPBSP;
     $reservation_data = $wpdb->get_row('SELECT * FROM ' . $DOPBSP->tables->woocommerce . ' WHERE variation_id=' . wc_get_order_item_meta($item_id, '_variation_id'));
     if ($reservation_data) {
         $reservation = json_decode($reservation_data->data);
         $reservation->currency = $reservation_data->currency;
         $reservation->item_id = $item_id;
         $calendar = $wpdb->get_row('SELECT * FROM ' . $DOPBSP->tables->calendars . ' WHERE id=' . $reservation_data->calendar_id);
         $settings = $wpdb->get_row('SELECT * FROM ' . $DOPBSP->tables->settings . ' WHERE calendar_id=' . $reservation_data->calendar_id);
         $DOPBSP->classes->translation->setTranslation($reservation_data->language, false);
         /*
          * Display details data.
          */
         wc_add_order_item_meta($item_id, $DOPBSP->text('RESERVATIONS_RESERVATION_DETAILS_TITLE'), $this->getDetails($reservation, $calendar, $settings));
         /*
          * Display extra data.
          */
         if ($settings->extra != 0) {
             wc_add_order_item_meta($item_id, $DOPBSP->text('EXTRAS_FRONT_END_TITLE'), $this->getExtras($reservation, $settings));
         }
         /*
          * Display discount data.
          */
         if ($settings->discount != 0) {
             wc_add_order_item_meta($item_id, $DOPBSP->text('DISCOUNTS_FRONT_END_TITLE'), $this->getDiscount($reservation, $settings));
         }
     }
 }
开发者ID:ConceptHaus,项目名称:jolie,代码行数:30,代码来源:class-woocommerce-order.php

示例2: sv_wc_pip_document_table_row_cells

/**
 * Filter the document table row cells to add custom column data
 *
 * @param string $table_row_cells The table row cells.
 * @param string $type WC_PIP_Document type
 * @param string $item_id Item id
 * @param array $item Item data
 * @param \WC_Product $product Product object
 * @param \WC_Order $order Order object
 * @return array The filtered table row cells.
 */
function sv_wc_pip_document_table_row_cells($table_row_cells, $document_type, $item_id, $item, $product, $order)
{
    // set custom column content for invoices
    if ('invoice' === $document_type) {
        $table_row_cells['warranty'] = wc_get_order_item_meta($item_id, '_warranty');
    } elseif ('packing-list' === $document_type || 'pick-list' === $document_type) {
        // display the value of the `_warehouse_location` order meta if it exists
        $table_row_cells['warehouse_location'] = $order->warehouse_location;
    }
    return $table_row_cells;
}
开发者ID:skyverge,项目名称:wc-plugins-snippets,代码行数:22,代码来源:custom-columns-warranty-warehouse.php

示例3: process_items

 /**
  * @param $order_id
  */
 public function process_items($order_id)
 {
     $order = new WC_Order($order_id);
     $items = $order->get_items(array('line_item'));
     // check general BooXtream conditions
     $accountkey = $this->settings->get_accountkey();
     if (!is_null($accountkey)) {
         foreach ($items as $item_id => $item) {
             $downloadlinks = wc_get_order_item_meta($item_id, '_bx_downloadlinks', true);
             if (!is_array($downloadlinks) && 'yes' === get_post_meta($item['product_id'], '_bx_booxtreamable', true)) {
                 $this->request_downloadlinks($item['product_id'], $order_id, $item_id);
                 // use this for actual data
             }
         }
     }
     return null;
 }
开发者ID:BooXtream,项目名称:BooXtream-WooCommerce,代码行数:20,代码来源:class-wc-booxtream-order.php

示例4: custom_order_details_page_info

 /**
  * Custom Title In Order View Page
  * @since 1.0
  */
 public function custom_order_details_page_info($order)
 {
     $is_donation = wc_get_order_item_meta($order->id, '_is_donation');
     if ($is_donation === true) {
         echo '<p><strong>' . get_option('wc_quick_donation_project_section_title') . ' :</strong>' . wc_get_order_item_meta($order->id, '_project_details') . '</p>';
     }
 }
开发者ID:reti-senza-frontiere,项目名称:WP-Plugins,代码行数:11,代码来源:woocommerce-quick-donation.php

示例5: get_packages_for_order_item

 /**
  * @param $item_id
  * @return array
  */
 public function get_packages_for_order_item($item_id)
 {
     return wc_get_order_item_meta($item_id, '_fraktguiden_packages', true);
 }
开发者ID:drivdigital,项目名称:bring-fraktguiden-for-woocommerce,代码行数:8,代码来源:class-bring-wc-order-adapter.php

示例6: woo_vou_codes_replace

 /**
  * Voucher Code Shortcode
  * Handles to replace the voucher code in purchase note
  * 
  * @package WooCommerce - PDF Vouchers
  * @since 1.6
  */
 function woo_vou_codes_replace($atts, $content)
 {
     global $woo_vou_order_item, $woo_vou_item_id;
     //Get prefix
     $prefix = WOO_VOU_META_PREFIX;
     // If order item is not empty
     if (!empty($woo_vou_order_item)) {
         //Get voucher codes
         $codes = wc_get_order_item_meta($woo_vou_item_id, $prefix . 'codes');
         $content .= $codes;
     }
     return $content;
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:20,代码来源:class-woo-vou-shortcodes.php

示例7: afterOrderItemMeta

 /**
  * Print appointment details inside order items in the backend.
  *
  * @param $item_id
  */
 public function afterOrderItemMeta($item_id)
 {
     $data = wc_get_order_item_meta($item_id, 'bookly');
     if ($data) {
         $other_data = $this->getItemData(array(), array('bookly' => $data));
         echo $other_data[0]['name'] . '<br/>' . nl2br($other_data[0]['value']);
     }
 }
开发者ID:patrickcurl,项目名称:monks,代码行数:13,代码来源:AB_WooCommerceController.php

示例8: woocommerce_get_order_item_meta

/**
 * @deprecated
 */
function woocommerce_get_order_item_meta($item_id, $key, $single = true)
{
    return wc_get_order_item_meta($item_id, $key, $single);
}
开发者ID:nayemDevs,项目名称:woocommerce,代码行数:7,代码来源:wc-deprecated-functions.php

示例9: filter_qty

 /**
  * @param $line_items
  * @return mixed
  */
 private function filter_qty($line_items)
 {
     foreach ($line_items as &$item) {
         $qty = wc_get_order_item_meta($item['id'], '_qty');
         $item['quantity'] = wc_stock_amount($qty);
     }
     return $line_items;
 }
开发者ID:rpidanny,项目名称:WooCommerce-POS,代码行数:12,代码来源:class-wc-pos-orders.php

示例10: render_column_content

 /**
  * Display the values for the listable columns
  *
  * @since 1.0
  * @param string $column the column name
  */
 public function render_column_content($column)
 {
     global $post, $wpdb;
     foreach (wc_checkout_add_ons()->get_add_ons($post->ID) as $add_on) {
         if ($column == $add_on->get_key()) {
             $query = $wpdb->prepare("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\twoi.order_item_id\n\t\t\t\t\tFROM {$wpdb->prefix}woocommerce_order_itemmeta woim\n\t\t\t\t\tRIGHT JOIN {$wpdb->prefix}woocommerce_order_items woi ON woim.order_item_id = woi.order_item_id\n\t\t\t\t\tWHERE 1=1\n\t\t\t\t\t\tAND woi.order_id = %d\n\t\t\t\t\t\tAND woim.meta_key = '_wc_checkout_add_on_id'\n\t\t\t\t\t\tAND woim.meta_value = %d\n\t\t\t\t\t", $post->ID, $add_on->id);
             $item_id = $wpdb->get_var($query);
             if ($item_id) {
                 switch ($add_on->type) {
                     case 'checkbox':
                         echo wc_get_order_item_meta($item_id, '_wc_checkout_add_on_value', true) ? '&#x2713;' : '';
                         break;
                     case 'file':
                         $file_ids = explode(',', wc_get_order_item_meta($item_id, '_wc_checkout_add_on_value', true));
                         $files_count = count($file_ids);
                         $file_labels = array();
                         echo '<a href="#" class="wc-checkout-add-ons-files-toggle">' . sprintf(_n('%d file', '%d files', $files_count, WC_Checkout_Add_Ons::TEXT_DOMAIN), $files_count) . '</a>';
                         echo '<ul class="wc-checkout-add-ons-files">';
                         foreach ($file_ids as $key => $file_id) {
                             if ($url = get_edit_post_link($file_id)) {
                                 echo '<li><a href="' . esc_url($url) . '">' . esc_html(get_the_title($file_id)) . '</a></li>';
                             } else {
                                 echo '<li>' . __('(File has been removed)', WC_Checkout_Add_Ons::TEXT_DOMAIN) . '</li>';
                             }
                         }
                         echo '</ul>';
                         break;
                     case 'text':
                     case 'textarea':
                         $label = wc_get_order_item_meta($item_id, '_wc_checkout_add_on_label', true);
                         echo $add_on->truncate_label($label);
                         break;
                     default:
                         $label = wc_get_order_item_meta($item_id, '_wc_checkout_add_on_label', true);
                         echo is_array($label) ? implode(', ', $label) : $label;
                 }
             }
             break;
         }
     }
 }
开发者ID:avijitdeb,项目名称:flatterbox.com,代码行数:47,代码来源:class-wc-checkout-add-ons-shop-order-cpt.php

示例11: woo_vou_process_product_pdf

/**
 * Generate PDF for Voucher
 *
 * Handles to Generate PDF on run time when
 * user will execute the url which is sent to
 * user email with purchase receipt
 *
 * @package WooCommerce - PDF Vouchers
 * @since   1.0.0
 */
function woo_vou_process_product_pdf($productid, $orderid, $item_id = '', $orderdvoucodes = array(), $pdf_args = array())
{
    $prefix = WOO_VOU_META_PREFIX;
    global $current_user, $woo_vou_model;
    //model class
    $model = $woo_vou_model;
    // If pdf argument is not array then make it array
    $pdf_args = !is_array($pdf_args) ? (array) $pdf_args : $pdf_args;
    // Taking voucher key
    if (!empty($pdf_args['pdf_vou_key'])) {
        $pdf_vou_key = $pdf_args['pdf_vou_key'];
    } else {
        $pdf_vou_key = isset($_GET['key']) ? $_GET['key'] : '';
    }
    if (!empty($productid) && !empty($orderid)) {
        // Check product id & order id are not empty
        //get all voucher details from order meta
        $allorderdata = $model->woo_vou_get_all_ordered_data($orderid);
        // Creating order object for order details
        $woo_order = new WC_Order($orderid);
        $woo_order_details = $woo_order;
        $items = $woo_order_details->get_items();
        foreach ($items as $key => $item) {
            $qty = $items[$key]['qty'];
        }
        // Getting product name
        $woo_product_details = $model->woo_vou_get_product_details($orderid, $items);
        // get product
        $product = wc_get_product($productid);
        // if product type is variable then $productid will contain variation id
        $variation_id = $productid;
        // check if product type is variable then we need to take parent id of variation id
        if ($product->is_type('variation') || $product->is_type('variable')) {
            // productid is variation id in case of variable product so we need to take actual product id
            $woo_variation = new WC_Product_Variation($productid);
            $productid = !empty($woo_variation->id) ? $woo_variation->id : $variation_id;
        }
        $product = wc_get_product($productid);
        $duree = get_the_terms($productid, 'pa_duree');
        $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $productid);
        $attachments = get_posts($args);
        if ($attachments) {
            foreach ($attachments as $attachment) {
                $image = wp_get_attachment_image($attachment->ID, 'full');
            }
        }
        // Getting order details
        $buyer_email = $woo_order_details->billing_email;
        $buyer_fname = $woo_order_details->billing_first_name;
        $buyer_lname = $woo_order_details->billing_last_name;
        $buyer_fullname = $buyer_fname . ' ' . $buyer_lname;
        $productname = isset($woo_product_details[$variation_id]) ? $woo_product_details[$variation_id]['product_name'] : '';
        //Added in version 2.3.7 for sold indivdual bug
        $item_key = $item_id;
        if (empty($item_key)) {
            $item_key = isset($woo_product_details[$variation_id]) ? $woo_product_details[$variation_id]['item_key'] : '';
        }
        $variation_data = $model->woo_vou_get_variation_data($woo_order, $item_key);
        $productname = $productname . $variation_data;
        //Get recipient fields
        $recipient_data = $model->woo_vou_get_recipient_data_using_item_key($woo_order, $item_key);
        $productprice = !empty($woo_product_details[$variation_id]['product_formated_price']) ? $woo_product_details[$variation_id]['product_formated_price'] : '';
        //Get voucher codes
        $voucher_codes = wc_get_order_item_meta($item_id, $prefix . 'codes');
        //get all voucher details from order meta
        $allvoucherdata = isset($allorderdata[$productid]) ? $allorderdata[$productid] : array();
        //how to use the voucher details
        $howtouse = isset($allvoucherdata['redeem']) ? $allvoucherdata['redeem'] : '';
        //start date
        $start_date = isset($allvoucherdata['start_date']) ? $allvoucherdata['start_date'] : '';
        //expiry data
        $exp_date = isset($allvoucherdata['exp_date']) ? $allvoucherdata['exp_date'] : '';
        //vou order date
        $orderdate = get_the_time('Y-m-d', $orderid);
        if (!empty($orderdate)) {
            $orderdate = $model->woo_vou_get_date_format($orderdate);
        }
        //vou logo
        $voulogo = isset($allvoucherdata['vendor_logo']) ? $allvoucherdata['vendor_logo'] : '';
        $voulogo = isset($voulogo['src']) && !empty($voulogo['src']) ? $voulogo['src'] : '';
        //vendor logo
        $voulogohtml = '';
        if (!empty($voulogo)) {
            $voulogohtml = '<img src="' . $voulogo . '" alt="" />';
        }
        //site logo
        $vousitelogohtml = '';
        $vou_site_url = get_option('vou_site_logo');
        if (!empty($vou_site_url)) {
            $vousitelogohtml = '<img src="' . $vou_site_url . '" alt="" />';
//.........这里部分代码省略.........
开发者ID:flasomm,项目名称:Montkailash,代码行数:101,代码来源:woo-vou-pdf-process.php

示例12: handle_download

 public function handle_download($query)
 {
     //gets the global query var object
     global $wp_query;
     if ($wp_query->get('bx-download')) {
         $item_id = $wp_query->get('bx-item-id');
         $download_id = $wp_query->get('bx-download-id');
         $bx_links = wc_get_order_item_meta($item_id, '_bx_downloadlinks');
         if (is_array($bx_links)) {
             if ($download_id === wc_get_order_item_meta($item_id, '_bx_epub_link')) {
                 $link = $bx_links['epub'];
             } elseif ($download_id === wc_get_order_item_meta($item_id, '_bx_mobi_link')) {
                 $link = $bx_links['mobi'];
             }
             header('Location: ' . $link);
             exit;
         } else {
             //gets the front page id set in options
             $page_id = get_option('woocommerce_download_processing_page_id');
             if (false === $page_id) {
                 echo '<h1>' . __('Your download is not ready yet', 'woocommerce_booxtream') . '</h1>';
                 echo '<p>' . __('We are currently processing your download, please try again in a few seconds', 'woocommerce_booxtream') . '</p>';
                 exit;
             }
             if (!$query->is_main_query()) {
                 return;
             }
             $query->set('post_type', 'page');
             $query->set('p', $page_id);
             //we remove the actions hooked on the '__after_loop' (post navigation)
             remove_all_actions('__after_loop');
             return $query;
         }
     }
 }
开发者ID:BooXtream,项目名称:BooXtream-WooCommerce,代码行数:35,代码来源:icontact-woocommerce-booxtream.php

示例13: woo_vou_my_pdf_vouchers_download_link

 /**
  * Adding Hooks
  *
  * Adding proper hoocks for the discount codes
  *
  * @package WooCommerce - PDF Vouchers
  * @since   2.3.1
  */
 public function woo_vou_my_pdf_vouchers_download_link($downloads = array())
 {
     //get prefix
     $prefix = WOO_VOU_META_PREFIX;
     if (is_user_logged_in()) {
         //If user is logged in
         //Get user ID
         $user_id = get_current_user_id();
         //Get User Order Arguments
         $args = array('numberposts' => -1, 'meta_key' => '_customer_user', 'meta_value' => $user_id, 'post_type' => WOO_VOU_MAIN_SHOP_POST_TYPE, 'post_status' => array('wc-completed'), 'meta_query' => array(array('key' => $prefix . 'meta_order_details', 'compare' => 'EXISTS')));
         //user orders
         $user_orders = get_posts($args);
         if (!empty($user_orders)) {
             //If orders are not empty
             foreach ($user_orders as $user_order) {
                 //Get order ID
                 $order_id = isset($user_order->ID) ? $user_order->ID : '';
                 if (!empty($order_id)) {
                     //Order it not empty
                     global $vou_order;
                     //Set global order ID
                     $vou_order = $order_id;
                     //Get cart details
                     $cart_details = new Wc_Order($order_id);
                     $order_items = $cart_details->get_items();
                     $order_date = isset($cart_details->order_date) ? $cart_details->order_date : '';
                     $order_date = date('d-m-y', strtotime($order_date));
                     if (!empty($order_items)) {
                         // Check cart details are not empty
                         foreach ($order_items as $item_id => $product_data) {
                             //Get product from Item ( It is required otherwise multipdf voucher link not work )
                             $_product = apply_filters('woocommerce_order_item_product', $cart_details->get_product_from_item($product_data), $product_data);
                             if (!$_product) {
                                 //If product deleted
                                 $download_file_data = array();
                             } else {
                                 //Get download files
                                 $download_file_data = $cart_details->get_item_downloads($product_data);
                             }
                             //Get voucher codes
                             $codes = wc_get_order_item_meta($item_id, $prefix . 'codes');
                             if (!empty($download_file_data) && !empty($codes)) {
                                 //If download exist and code is not empty
                                 foreach ($download_file_data as $key => $download_file) {
                                     //check download key is voucher key or not
                                     $check_key = strpos($key, 'woo_vou_pdf_');
                                     //get voucher number
                                     $voucher_number = str_replace('woo_vou_pdf_', '', $key);
                                     if (empty($voucher_number)) {
                                         //If empty voucher number
                                         $voucher_number = 1;
                                     }
                                     if (!empty($download_file) && $check_key !== false) {
                                         //Get download URL
                                         $download_url = $download_file['download_url'];
                                         //add arguments array
                                         $add_arguments = array('item_id' => $item_id);
                                         //PDF Download URL
                                         $download_url = add_query_arg($add_arguments, $download_url);
                                         //get product name
                                         $product_name = isset($_product->post->post_title) ? $_product->post->post_title : '';
                                         //Download file arguments
                                         $download_args = array('download_url' => $download_url, 'download_name' => $product_name . ' - ' . $download_file['name'] . ' ' . $voucher_number . ' ( ' . $order_date . ' )', 'downloads_remaining' => '');
                                         //append voucher download to downloads array
                                         $downloads[] = $download_args;
                                     }
                                 }
                             }
                         }
                     }
                     //reset global order ID
                     $vou_order = 0;
                 }
             }
         }
     }
     return $downloads;
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:86,代码来源:class-woo-vou-public.php

示例14: refund_transaction

 /**
  * Refund a transaction
  *
  * @param $order_id
  * @param $refund_id
  *
  * @return bool
  */
 public function refund_transaction($order_id, $refund_id)
 {
     // Get the Taxamo transaction key
     $transaction_key = get_post_meta($order_id, 'taxamo_transaction_key', true);
     // Get refund
     $refund = wc_get_order($refund_id);
     // Get refund line items
     $refund_items = $refund->get_items(array('line_item', 'shipping'));
     // Check & loop
     if (count($refund_items) > 0) {
         foreach ($refund_items as $refund_item) {
             // Get the line key
             $line_key = wc_get_order_item_meta($refund_item['refunded_item_id'], self::OIM_LINE_KEY, true);
             // Only do the refund when the line item exists
             if ('' !== $line_key) {
                 // Get correct amount
                 $amount = abs(isset($refund_item['line_total']) ? $refund_item['line_total'] : (isset($refund_item['cost']) ? $refund_item['cost'] : 0));
                 // Only continue if amount > 0
                 if ($amount > 0) {
                     // Create refund request
                     $refund_request = new WC_TA_Request_Refund($transaction_key, $line_key, $amount);
                     // Do the rquest
                     $refund_request->do_request();
                 }
             }
         }
     }
     // Refund done
     return true;
 }
开发者ID:narendra-addweb,项目名称:MyImmoPix,代码行数:38,代码来源:class-wc-ta-taxamo-manager.php

示例15: recalculate_order

 public function recalculate_order($order_id)
 {
     $order_currency = get_post_meta($order_id, '_order_currency', true);
     //lets avoid recalculation for order which is already in
     if ($order_currency == $this->default_currency or empty($order_currency)) {
         return;
     }
     //***
     $currencies = $this->get_currencies();
     $_woocs_order_rate = get_post_meta($order_id, '_woocs_order_rate', true);
     if (empty($_woocs_order_rate)) {
         $_woocs_order_rate = $currencies[$order_currency]['rate'];
     }
     //***
     update_post_meta($order_id, '_woocs_order_currency', $this->default_currency);
     update_post_meta($order_id, '_order_currency', $this->default_currency);
     update_post_meta($order_id, '_woocs_order_base_currency', $this->default_currency);
     wc_update_order_item_meta($order_id, '_woocs_order_base_currency', $this->default_currency);
     update_post_meta($order_id, '_woocs_order_rate', 1);
     wc_update_order_item_meta($order_id, '_woocs_order_rate', 1);
     update_post_meta($order_id, '_woocs_order_currency_changed_mannualy', time());
     wc_add_order_item_meta($order_id, '_woocs_order_currency_changed_mannualy', time(), true);
     //***
     $_order_shipping = get_post_meta($order_id, '_order_shipping', true);
     update_post_meta($order_id, '_order_shipping', $this->back_convert($_order_shipping, $_woocs_order_rate));
     $_order_total = get_post_meta($order_id, '_order_total', true);
     update_post_meta($order_id, '_order_total', $this->back_convert($_order_total, $_woocs_order_rate));
     $_refund_amount = get_post_meta($order_id, '_refund_amount', true);
     update_post_meta($order_id, '_refund_amount', $this->back_convert($_refund_amount, $_woocs_order_rate));
     $_cart_discount_tax = get_post_meta($order_id, '_cart_discount_tax', true);
     update_post_meta($order_id, '_cart_discount_tax', $this->back_convert($_cart_discount_tax, $_woocs_order_rate));
     $_order_tax = get_post_meta($order_id, '_order_tax', true);
     update_post_meta($order_id, '_order_tax', $this->back_convert($_order_tax, $_woocs_order_rate));
     $_order_shipping_tax = get_post_meta($order_id, '_order_shipping_tax', true);
     update_post_meta($order_id, '_order_shipping_tax', $this->back_convert($_order_shipping_tax, $_woocs_order_rate));
     $_cart_discount = get_post_meta($order_id, '_cart_discount', true);
     update_post_meta($order_id, '_cart_discount', $this->back_convert($_cart_discount, $_woocs_order_rate));
     //***
     global $wpdb;
     $get_items_sql = $wpdb->prepare("SELECT order_item_id,order_item_type FROM {$wpdb->prefix}woocommerce_order_items WHERE order_id = %d ", $order_id);
     $line_items = $wpdb->get_results($get_items_sql, ARRAY_N);
     if (!empty($line_items) and is_array($line_items)) {
         foreach ($line_items as $v) {
             $order_item_id = $v[0];
             $order_item_type = $v[1];
             switch ($order_item_type) {
                 case 'line_item':
                     $amount = wc_get_order_item_meta($order_item_id, '_line_subtotal', true);
                     wc_update_order_item_meta($order_item_id, '_line_subtotal', $this->back_convert($amount, $_woocs_order_rate, 2));
                     $amount = wc_get_order_item_meta($order_item_id, '_line_total', true);
                     wc_update_order_item_meta($order_item_id, '_line_total', $this->back_convert($amount, $_woocs_order_rate, 2));
                     $amount = wc_get_order_item_meta($order_item_id, '_line_subtotal_tax', true);
                     wc_update_order_item_meta($order_item_id, '_line_subtotal_tax', $this->back_convert($amount, $_woocs_order_rate, 2));
                     $amount = wc_get_order_item_meta($order_item_id, '_line_tax', true);
                     wc_update_order_item_meta($order_item_id, '_line_tax', $this->back_convert($amount, $_woocs_order_rate, 2));
                     $_line_tax_data = wc_get_order_item_meta($order_item_id, '_line_tax_data', true);
                     if (!empty($_line_tax_data) and is_array($_line_tax_data)) {
                         foreach ($_line_tax_data as $key => $values) {
                             if (!empty($values)) {
                                 if (is_array($values)) {
                                     foreach ($values as $k => $value) {
                                         if (is_numeric($value)) {
                                             $_line_tax_data[$key][$k] = $this->back_convert($value, $_woocs_order_rate, 2);
                                         }
                                     }
                                 } else {
                                     if (is_numeric($values)) {
                                         $_line_tax_data[$key] = $this->back_convert($values, $_woocs_order_rate, 2);
                                     }
                                 }
                             }
                         }
                     }
                     wc_update_order_item_meta($order_item_id, '_line_tax_data', $_line_tax_data);
                     break;
                 case 'shipping':
                     $amount = wc_get_order_item_meta($order_item_id, 'cost', true);
                     wc_update_order_item_meta($order_item_id, 'cost', $this->back_convert($amount, $_woocs_order_rate, 2));
                     $taxes = wc_get_order_item_meta($order_item_id, 'taxes', true);
                     if (!empty($taxes) and is_array($taxes)) {
                         foreach ($taxes as $key => $values) {
                             if (!empty($values)) {
                                 if (is_array($values)) {
                                     foreach ($values as $k => $value) {
                                         if (is_numeric($value)) {
                                             $taxes[$key][$k] = $this->back_convert($value, $_woocs_order_rate, 2);
                                         }
                                     }
                                 } else {
                                     if (is_numeric($values)) {
                                         $taxes[$key] = $this->back_convert($values, $_woocs_order_rate, 2);
                                     }
                                 }
                             }
                         }
                     }
                     wc_update_order_item_meta($order_item_id, 'taxes', $taxes);
                     break;
                 case 'tax':
                     $amount = wc_get_order_item_meta($order_item_id, 'tax_amount', true);
//.........这里部分代码省略.........
开发者ID:benkhlifafahmi,项目名称:woocomerce-currency-switcher-fix,代码行数:101,代码来源:index.php


注:本文中的wc_get_order_item_meta函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。