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


PHP WC_Order_Item_Meta::add方法代码示例

本文整理汇总了PHP中WC_Order_Item_Meta::add方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Order_Item_Meta::add方法的具体用法?PHP WC_Order_Item_Meta::add怎么用?PHP WC_Order_Item_Meta::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Order_Item_Meta的用法示例。


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

示例1: woocommerce_process_shop_order_meta

/**
 * Save the order data meta box.
 *
 * @access public
 * @param mixed $post_id
 * @param mixed $post
 * @return void
 */
function woocommerce_process_shop_order_meta($post_id, $post)
{
    global $wpdb, $woocommerce, $woocommerce_errors;
    // Add key
    add_post_meta($post_id, '_order_key', uniqid('order_'), true);
    // Update post data
    update_post_meta($post_id, '_billing_first_name', stripslashes($_POST['_billing_first_name']));
    update_post_meta($post_id, '_billing_last_name', stripslashes($_POST['_billing_last_name']));
    update_post_meta($post_id, '_billing_company', stripslashes($_POST['_billing_company']));
    update_post_meta($post_id, '_billing_address_1', stripslashes($_POST['_billing_address_1']));
    update_post_meta($post_id, '_billing_address_2', stripslashes($_POST['_billing_address_2']));
    update_post_meta($post_id, '_billing_city', stripslashes($_POST['_billing_city']));
    update_post_meta($post_id, '_billing_postcode', stripslashes($_POST['_billing_postcode']));
    update_post_meta($post_id, '_billing_country', stripslashes($_POST['_billing_country']));
    update_post_meta($post_id, '_billing_state', stripslashes($_POST['_billing_state']));
    update_post_meta($post_id, '_billing_email', stripslashes($_POST['_billing_email']));
    update_post_meta($post_id, '_billing_phone', stripslashes($_POST['_billing_phone']));
    update_post_meta($post_id, '_shipping_first_name', stripslashes($_POST['_shipping_first_name']));
    update_post_meta($post_id, '_shipping_last_name', stripslashes($_POST['_shipping_last_name']));
    update_post_meta($post_id, '_shipping_company', stripslashes($_POST['_shipping_company']));
    update_post_meta($post_id, '_shipping_address_1', stripslashes($_POST['_shipping_address_1']));
    update_post_meta($post_id, '_shipping_address_2', stripslashes($_POST['_shipping_address_2']));
    update_post_meta($post_id, '_shipping_city', stripslashes($_POST['_shipping_city']));
    update_post_meta($post_id, '_shipping_postcode', stripslashes($_POST['_shipping_postcode']));
    update_post_meta($post_id, '_shipping_country', stripslashes($_POST['_shipping_country']));
    update_post_meta($post_id, '_shipping_state', stripslashes($_POST['_shipping_state']));
    update_post_meta($post_id, '_order_shipping', stripslashes($_POST['_order_shipping']));
    update_post_meta($post_id, '_cart_discount', stripslashes($_POST['_cart_discount']));
    update_post_meta($post_id, '_order_discount', stripslashes($_POST['_order_discount']));
    update_post_meta($post_id, '_order_total', stripslashes($_POST['_order_total']));
    update_post_meta($post_id, '_customer_user', (int) $_POST['customer_user']);
    update_post_meta($post_id, '_order_tax', stripslashes($_POST['_order_tax']));
    update_post_meta($post_id, '_order_shipping_tax', stripslashes($_POST['_order_shipping_tax']));
    // Shipping method handling
    if (get_post_meta($post_id, '_shipping_method', true) !== stripslashes($_POST['_shipping_method'])) {
        $shipping_method = esc_attr(trim(stripslashes($_POST['_shipping_method'])));
        update_post_meta($post_id, '_shipping_method', $shipping_method);
    }
    if (get_post_meta($post_id, '_shipping_method_title', true) !== stripslashes($_POST['_shipping_method_title'])) {
        $shipping_method_title = esc_attr(trim(stripslashes($_POST['_shipping_method_title'])));
        if (!$shipping_method_title) {
            $shipping_method = esc_attr($_POST['_shipping_method']);
            $methods = $woocommerce->shipping->load_shipping_methods();
            if (isset($methods) && isset($methods[$shipping_method])) {
                $shipping_method_title = $methods[$shipping_method]->get_title();
            }
        }
        update_post_meta($post_id, '_shipping_method_title', $shipping_method_title);
    }
    // Payment method handling
    if (get_post_meta($post_id, '_payment_method', true) !== stripslashes($_POST['_payment_method'])) {
        $methods = $woocommerce->payment_gateways->payment_gateways();
        $payment_method = esc_attr($_POST['_payment_method']);
        $payment_method_title = $payment_method;
        if (isset($methods) && isset($methods[$payment_method])) {
            $payment_method_title = $methods[$payment_method]->get_title();
        }
        update_post_meta($post_id, '_payment_method', $payment_method);
        update_post_meta($post_id, '_payment_method_title', $payment_method_title);
    }
    // Update date
    if (empty($_POST['order_date'])) {
        $date = current_time('timestamp');
    } else {
        $date = strtotime($_POST['order_date'] . ' ' . (int) $_POST['order_date_hour'] . ':' . (int) $_POST['order_date_minute'] . ':00');
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET post_date = %s WHERE ID = %s", date_i18n('Y-m-d H:i:s', $date), $post_id));
    // Tax rows
    $order_taxes = array();
    if (isset($_POST['_order_taxes_label'])) {
        $order_taxes_label = $_POST['_order_taxes_label'];
        $order_taxes_compound = isset($_POST['_order_taxes_compound']) ? $_POST['_order_taxes_compound'] : array();
        $order_taxes_cart = $_POST['_order_taxes_cart'];
        $order_taxes_shipping = $_POST['_order_taxes_shipping'];
        $order_taxes_label_count = sizeof($order_taxes_label);
        for ($i = 0; $i < $order_taxes_label_count; $i++) {
            // Add to array if the tax amount is set
            if (!$order_taxes_cart[$i] && !$order_taxes_shipping[$i]) {
                continue;
            }
            if (!$order_taxes_label[$i]) {
                $order_taxes_label[$i] = $woocommerce->countries->tax_or_vat();
            }
            if (isset($order_taxes_compound[$i])) {
                $is_compound = 1;
            } else {
                $is_compound = 0;
            }
            $order_taxes[] = array('label' => esc_attr($order_taxes_label[$i]), 'compound' => $is_compound, 'cart_tax' => esc_attr($order_taxes_cart[$i]), 'shipping_tax' => esc_attr($order_taxes_shipping[$i]));
        }
    }
    update_post_meta($post_id, '_order_taxes', $order_taxes);
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:writepanel-order_data.php

示例2: add_order_item_meta

 /**
  * Add each subscription product's details to an order so that the state of the subscription persists even when a product is changed
  *
  * @since 1.2
  */
 public static function add_order_item_meta($order_item)
 {
     global $woocommerce;
     if (WC_Subscriptions_Product::is_subscription($order_item['id'])) {
         // Make sure existing meta persists
         $item_meta = new WC_Order_Item_Meta($order_item['item_meta']);
         // Add subscription details so order state persists even when a product is changed
         $item_meta->add('_subscription_period', WC_Subscriptions_Product::get_period($order_item['id']));
         $item_meta->add('_subscription_interval', WC_Subscriptions_Product::get_interval($order_item['id']));
         $item_meta->add('_subscription_length', WC_Subscriptions_Product::get_length($order_item['id']));
         $item_meta->add('_subscription_trial_length', WC_Subscriptions_Product::get_trial_length($order_item['id']));
         $item_meta->add('_subscription_trial_period', WC_Subscriptions_Product::get_trial_period($order_item['id']));
         $item_meta->add('_subscription_recurring_amount', $woocommerce->cart->base_recurring_prices[$order_item['id']]);
         // WC_Subscriptions_Product::get_price() would return a price without filters applied
         $item_meta->add('_subscription_sign_up_fee', WC_Subscriptions_Product::get_sign_up_fee($order_item['id']));
         // Calculated recurring amounts for the item
         $item_meta->add('_recurring_line_total', $woocommerce->cart->recurring_cart_contents[$order_item['id']]['recurring_line_total']);
         $item_meta->add('_recurring_line_tax', $woocommerce->cart->recurring_cart_contents[$order_item['id']]['recurring_line_tax']);
         $item_meta->add('_recurring_line_subtotal', $woocommerce->cart->recurring_cart_contents[$order_item['id']]['recurring_line_subtotal']);
         $item_meta->add('_recurring_line_subtotal_tax', $woocommerce->cart->recurring_cart_contents[$order_item['id']]['recurring_line_subtotal_tax']);
         $order_item['item_meta'] = $item_meta->meta;
     }
     return $order_item;
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:29,代码来源:class-wc-subscriptions-checkout.php

示例3: define

 /**
  * Process the checkout after the confirm order button is pressed
  *
  * @access public
  * @return void
  */
 function process_checkout()
 {
     global $wpdb, $woocommerce;
     if (!defined('WOOCOMMERCE_CHECKOUT')) {
         define('WOOCOMMERCE_CHECKOUT', true);
     }
     $woocommerce->verify_nonce('process_checkout');
     do_action('woocommerce_before_checkout_process');
     if (sizeof($woocommerce->cart->get_cart()) == 0) {
         $woocommerce->add_error(sprintf(__('Sorry, your session has expired. <a href="%s">Return to homepage &rarr;</a>', 'woocommerce'), home_url()));
     }
     do_action('woocommerce_checkout_process');
     // Checkout fields (not defined in checkout_fields)
     $this->posted['shiptobilling'] = isset($_POST['shiptobilling']) ? 1 : 0;
     $this->posted['terms'] = isset($_POST['terms']) ? 1 : 0;
     $this->posted['createaccount'] = isset($_POST['createaccount']) ? 1 : 0;
     $this->posted['payment_method'] = isset($_POST['payment_method']) ? woocommerce_clean($_POST['payment_method']) : '';
     $this->posted['shipping_method'] = isset($_POST['shipping_method']) ? woocommerce_clean($_POST['shipping_method']) : '';
     // Ship to billing only option
     if ($woocommerce->cart->ship_to_billing_address_only()) {
         $this->posted['shiptobilling'] = 1;
     }
     // Update customer shipping and payment method to posted method
     $_SESSION['_chosen_shipping_method'] = $this->posted['shipping_method'];
     $_SESSION['_chosen_payment_method'] = $this->posted['payment_method'];
     // Note if we skip shipping
     $skipped_shipping = false;
     // Get validation class
     $validation = $woocommerce->validation();
     // Get posted checkout_fields and do validation
     foreach ($this->checkout_fields as $fieldset_key => $fieldset) {
         // Skip shipping if its not needed
         if ($fieldset_key == 'shipping' && ($woocommerce->cart->ship_to_billing_address_only() || $this->posted['shiptobilling'] || !$woocommerce->cart->needs_shipping() && get_option('woocommerce_require_shipping_address') == 'no')) {
             $skipped_shipping = true;
             continue;
         }
         foreach ($fieldset as $key => $field) {
             if (!isset($field['type'])) {
                 $field['type'] = 'text';
             }
             // Get Value
             switch ($field['type']) {
                 case "checkbox":
                     $this->posted[$key] = isset($_POST[$key]) ? 1 : 0;
                     break;
                 default:
                     $this->posted[$key] = isset($_POST[$key]) ? woocommerce_clean($_POST[$key]) : '';
                     break;
             }
             // Hook to allow modification of value
             $this->posted[$key] = apply_filters('woocommerce_process_checkout_field_' . $key, $this->posted[$key]);
             // Validation: Required fields
             if (isset($field['required']) && $field['required'] && empty($this->posted[$key])) {
                 $woocommerce->add_error('<strong>' . $field['label'] . '</strong> ' . __('is a required field.', 'woocommerce'));
             }
             if (!empty($this->posted[$key])) {
                 // Special handling for validation and formatting
                 switch ($key) {
                     case "billing_postcode":
                     case "shipping_postcode":
                         $validate_against = $key == 'billing_postcode' ? 'billing_country' : 'shipping_country';
                         $this->posted[$key] = strtoupper(str_replace(' ', '', $this->posted[$key]));
                         if (!$validation->is_postcode($this->posted[$key], $_POST[$validate_against])) {
                             $woocommerce->add_error('<strong>' . $field['label'] . '</strong> ' . sprintf(__('(%s) is not a valid postcode/ZIP.', 'woocommerce'), $this->posted[$key]));
                         } else {
                             $this->posted[$key] = $validation->format_postcode($this->posted[$key], $_POST[$validate_against]);
                         }
                         break;
                     case "billing_state":
                     case "shipping_state":
                         // Get valid states
                         $validate_against = $key == 'billing_state' ? 'billing_country' : 'shipping_country';
                         $valid_states = $woocommerce->countries->get_states($_POST[$validate_against]);
                         if ($valid_states) {
                             $valid_state_values = array_flip(array_map('strtolower', $valid_states));
                         }
                         // Convert value to key if set
                         if (isset($valid_state_values[strtolower($this->posted[$key])])) {
                             $this->posted[$key] = $valid_state_values[strtolower($this->posted[$key])];
                         }
                         // Only validate if the country has specific state options
                         if ($valid_states && sizeof($valid_states) > 0) {
                             if (!in_array($this->posted[$key], array_keys($valid_states))) {
                                 $woocommerce->add_error('<strong>' . $field['label'] . '</strong> ' . __('is not valid. Please enter one of the following:', 'woocommerce') . ' ' . implode(', ', $valid_states));
                             }
                         }
                         break;
                     case "billing_phone":
                         $this->posted[$key] = $validation->format_phone($this->posted[$key]);
                         if (!$validation->is_phone($this->posted[$key])) {
                             $woocommerce->add_error('<strong>' . $field['label'] . '</strong> ' . __('is not a valid number.', 'woocommerce'));
                         }
                         break;
                     case "billing_email":
//.........这里部分代码省略.........
开发者ID:hscale,项目名称:webento,代码行数:101,代码来源:class-wc-checkout.php

示例4: prefill_order_item_meta_old

 /**
  * Add subscription related order item meta via Ajax when a subscription product is added as an item to an order.
  *
  * This function is hooked to the 'wp_ajax_woocommerce_subscriptions_prefill_order_item_meta' hook which should only fire
  * on WC 1.x (because the admin.js uses a selector which was changed in WC 2.0). For WC 2.0, order item meta is pre-filled
  * via the 'woocommerce_new_order_item' hook in the new @see self::prefill_order_item().
  *
  * @since 1.2.4
  * @return void
  */
 public static function prefill_order_item_meta_old()
 {
     if (function_exists('woocommerce_add_order_item_meta')) {
         // Meta added on the 'woocommerce_new_order_item' hook
         return;
     }
     check_ajax_referer(WC_Subscriptions::$text_domain, 'security');
     $product_id = trim(stripslashes($_POST['item_to_add']));
     $index = trim(stripslashes($_POST['index']));
     $response = array('item_index' => $index, 'html' => '', 'line_totals' => array());
     if (WC_Subscriptions_Product::is_subscription($product_id)) {
         $recurring_amount = WC_Subscriptions_Product::get_price($product_id);
         $item_meta = new WC_Order_Item_Meta();
         // Subscription details so order state persists even when a product is changed
         $item_meta->add('_subscription_period', WC_Subscriptions_Product::get_period($product_id));
         $item_meta->add('_subscription_interval', WC_Subscriptions_Product::get_interval($product_id));
         $item_meta->add('_subscription_length', WC_Subscriptions_Product::get_length($product_id));
         $item_meta->add('_subscription_trial_length', WC_Subscriptions_Product::get_trial_length($product_id));
         $item_meta->add('_subscription_trial_period', WC_Subscriptions_Product::get_trial_period($product_id));
         $item_meta->add('_subscription_recurring_amount', $recurring_amount);
         $item_meta->add('_subscription_sign_up_fee', WC_Subscriptions_Product::get_sign_up_fee($product_id));
         // Recurring totals need to be calcualted
         $item_meta->add('_recurring_line_total', $recurring_amount);
         $item_meta->add('_recurring_line_tax', 0);
         $item_meta->add('_recurring_line_subtotal', $recurring_amount);
         $item_meta->add('_recurring_line_subtotal_tax', 0);
         $item_meta = $item_meta->meta;
         if (isset($item_meta) && is_array($item_meta) && sizeof($item_meta) > 0) {
             foreach ($item_meta as $key => $meta) {
                 // Backwards compatibility
                 if (is_array($meta) && isset($meta['meta_name'])) {
                     $meta_name = $meta['meta_name'];
                     $meta_value = $meta['meta_value'];
                 } else {
                     $meta_name = $key;
                     $meta_value = $meta;
                 }
                 $response['html'] .= '<tr><td><input type="text" name="meta_name[' . $index . '][]" value="' . esc_attr($meta_name) . '" /></td><td><input type="text" name="meta_value[' . $index . '][]" value="' . esc_attr($meta_value) . '" /></td><td width="1%"></td></tr>';
             }
         }
         // Calculate line totals for this item
         if ($sign_up_fee > 0) {
             $line_subtotal = $sign_up_fee;
             $line_total = $sign_up_fee;
             // If there is no free trial, add the recuring amounts
             if ($trial_length == 0) {
                 $line_subtotal += $recurring_amount;
                 $line_total += $recurring_amount;
             }
             $response['line_totals']['line_subtotal'] = esc_attr(number_format((double) $line_subtotal, 2, '.', ''));
             $response['line_totals']['line_total'] = esc_attr(number_format((double) $line_total, 2, '.', ''));
         }
     }
     echo json_encode($response);
     die;
 }
开发者ID:bulats,项目名称:chef,代码行数:66,代码来源:class-wc-subscriptions-order.php

示例5: upgrade_database


//.........这里部分代码省略.........
         $order_tax = get_post_meta($order_id, '_order_tax', true);
         // $order->get_total_tax() includes shipping tax
         update_post_meta($order_id, '_order_recurring_tax_total', $order_tax);
         $order_total = $order->get_total();
         update_post_meta($order_id, '_order_recurring_total', $order_total);
         // Set order totals to include sign up fee fields, if there was a sign up fee on the order and a trial period (other wise, the recurring totals are correct)
         if ($sign_up_fee_total > 0) {
             // Order totals need to be changed to be equal to sign up fee totals
             if ($has_trial) {
                 $cart_discount = WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_discount_cart', 0);
                 $order_discount = WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_discount_total', 0);
                 $order_tax = WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_tax_total', 0);
                 $order_total = $sign_up_fee_total;
             } else {
                 // No trial, sign up fees need to be added to order totals
                 $cart_discount += WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_discount_cart', 0);
                 $order_discount += WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_discount_total', 0);
                 $order_tax += WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_tax_total', 0);
                 $order_total += $sign_up_fee_total;
             }
             update_post_meta($order_id, '_order_total', $order_total);
             update_post_meta($order_id, '_cart_discount', $cart_discount);
             update_post_meta($order_id, '_order_discount', $order_discount);
             update_post_meta($order_id, '_order_tax', $order_tax);
         }
         $order_taxes = $order->get_taxes();
         // Set recurring taxes to order taxes
         update_post_meta($order_id, '_order_recurring_taxes', $order_taxes);
         $sign_up_fee_taxes = WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_taxes', array());
         // Update order taxes to include sign up fee taxes
         foreach ($sign_up_fee_taxes as $index => $sign_up_tax) {
             if ($has_trial && $sign_up_fee_total > 0) {
                 // Order taxes need to be set to the same as the sign up fee taxes
                 if (isset($sign_up_tax['cart_tax']) && $sign_up_tax['cart_tax'] > 0) {
                     $order_taxes[$index]['cart_tax'] = $sign_up_tax['cart_tax'];
                 }
             } elseif (!$has_trial && $sign_up_fee_total > 0) {
                 // Sign up fee taxes need to be added to order taxes
                 if (isset($sign_up_tax['cart_tax']) && $sign_up_tax['cart_tax'] > 0) {
                     $order_taxes[$index]['cart_tax'] += $sign_up_tax['cart_tax'];
                 }
             }
         }
         update_post_meta($order_id, '_order_taxes', $order_taxes);
         /* Upgrade each order item to use new Item Meta schema */
         $order_subscription_periods = WC_Subscriptions_Order::get_meta($order_id, '_order_subscription_periods', array());
         $order_subscription_intervals = WC_Subscriptions_Order::get_meta($order_id, '_order_subscription_intervals', array());
         $order_subscription_lengths = WC_Subscriptions_Order::get_meta($order_id, '_order_subscription_lengths', array());
         $order_subscription_trial_lengths = WC_Subscriptions_Order::get_meta($order_id, '_order_subscription_trial_lengths', array());
         $order_items = $order->get_items();
         foreach ($order_items as $index => $order_item) {
             $item_meta = new WC_Order_Item_Meta($order_item['item_meta']);
             $subscription_interval = isset($order_subscription_intervals[$order_item['id']]) ? $order_subscription_intervals[$order_item['id']] : 1;
             $subscription_length = isset($order_subscription_lengths[$order_item['id']]) ? $order_subscription_lengths[$order_item['id']] : 0;
             $subscription_trial_length = isset($order_subscription_trial_lengths[$order_item['id']]) ? $order_subscription_trial_lengths[$order_item['id']] : 0;
             $item_meta->add('_subscription_period', $order_subscription_periods[$order_item['id']]);
             $item_meta->add('_subscription_interval', $subscription_interval);
             $item_meta->add('_subscription_length', $subscription_length);
             $item_meta->add('_subscription_trial_length', $subscription_trial_length);
             $item_meta->add('_subscription_recurring_amount', $order_item['line_subtotal']);
             // WC_Subscriptions_Product::get_price() would return a price without filters applied
             $item_meta->add('_subscription_sign_up_fee', WC_Subscriptions_Order::get_meta($order, '_cart_contents_sign_up_fee_total', 0));
             // Set recurring amounts for the item
             $item_meta->add('_recurring_line_total', $order_item['line_total']);
             $item_meta->add('_recurring_line_tax', $order_item['line_tax']);
             $item_meta->add('_recurring_line_subtotal', $order_item['line_subtotal']);
             $item_meta->add('_recurring_line_subtotal_tax', $order_item['line_subtotal_tax']);
             if ($sign_up_fee_total > 0) {
                 // Discounted price * Quantity
                 $sign_up_fee_line_total = WC_Subscriptions_Order::get_meta($order, '_cart_contents_sign_up_fee_total', 0);
                 $sign_up_fee_line_tax = WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_tax_total', 0);
                 // Base price * Quantity
                 $sign_up_fee_line_subtotal = WC_Subscriptions_Order::get_meta($order, '_cart_contents_sign_up_fee_total', 0) + WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_discount_cart', 0);
                 $sign_up_fee_propotion = $sign_up_fee_line_total > 0 ? $sign_up_fee_line_subtotal / $sign_up_fee_line_total : 0;
                 $sign_up_fee_line_subtotal_tax = WC_Subscriptions_Manager::get_amount_from_proportion(WC_Subscriptions_Order::get_meta($order, '_sign_up_fee_tax_total', 0), $sign_up_fee_propotion);
                 if ($has_trial) {
                     // Set line item totals equal to sign up fee totals
                     $order_item['line_subtotal'] = $sign_up_fee_line_subtotal;
                     $order_item['line_subtotal_tax'] = $sign_up_fee_line_subtotal_tax;
                     $order_item['line_total'] = $sign_up_fee_line_total;
                     $order_item['line_tax'] = $sign_up_fee_line_tax;
                 } else {
                     // No trial period, sign up fees need to be added to order totals
                     $order_item['line_subtotal'] += $sign_up_fee_line_subtotal;
                     $order_item['line_subtotal_tax'] += $sign_up_fee_line_subtotal_tax;
                     $order_item['line_total'] += $sign_up_fee_line_total;
                     $order_item['line_tax'] += $sign_up_fee_line_tax;
                 }
             }
             $order_item['item_meta'] = $item_meta->meta;
             $order_items[$index] = $order_item;
         }
         // Save the new meta on the order items
         update_post_meta($order_id, '_order_items', $order_items);
         $upgraded_orders[] = $order_id;
         update_option('wcs_1_2_upgraded_order_ids', $upgraded_orders);
     }
     // Remove the lock on upgrading
     delete_transient('wc_subscriptions_is_upgrading');
 }
开发者ID:edelkevis,项目名称:git-plus-wordpress,代码行数:101,代码来源:class-wc-subscriptions-upgrader.php


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