To achieve what you want you’re better creating an associative array and then walking over it with a foreach loop as shown below :
$data = array(
'_shipping_first_name' => $order->get_billing_first_name(),
'_shipping_last_name' => $order->get_billing_last_name(),
'_shipping_company' => $order->get_billing_company(),
'_shipping_address_1' => $order->get_billing_address_1(),
'_shipping_address_2' => $order->get_billing_address_2(),
'_shipping_postcode' => $order->get_billing_postcode(),
'_shipping_city' => $order->get_billing_city(),
'_shipping_state' => $order->get_billing_state(),
'_shipping_country' => $order->get_billing_country()
);
foreach ( $data as $meta_key => $meta_value ) {
update_post_meta( $order_id, $meta_key, $meta_value );
}
Related Posts:
- How to check if a plugin (WooCommerce) is active?
- How to trigger WooCommerce order complete email?
- How to get Woocommerce order product info
- Woocommerce auto cancel On-Hold after X days
- Use wc_enqueue_js only on specific pages – nested add_action
- Replace existing content from specific WooCommerce admin orders list column
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Display related products with custom output
- Woocommerce filter cart and category specific quantity [closed]
- Use is_product_category() properly
- How to get woocommerce cart content without an action?
- WooCommerce: Add Payment Gateway Field to Webhooks [closed]
- Changing Woocommerce flat rate every nth number of items
- Woocommerce product download URL
- How to select WooCommerce products by post_meta and order them
- Limiting woocommerce line_total decimal length
- How can I use wp_query to show all product data using just the products ID?
- Get stock by custom meta field on all Woocommerce variable products
- Set a condition based on WooCommerce checkout city field while placing order
- Call global variable array() in woocommerce child/template
- Remove price from Woocommerce variable product dropdown menu
- Get and insert order email address to the PHP template inside HTML text
- Auto-update products after they were published – Woocommerce
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- If no products are on sale – hide ID or class
- do search in two site and show the result in first site
- Which field should I edit to make the checkbox marked by default?
- wordpress + woocommerce display product with additional information [closed]
- How can I pass a custom/dynamic product to the Woocommerce cart?
- How to display SQL query that ran in WC_Order_Query?
- How to disable delivery on certain date at checkout page in WooCommerce?
- How do I change this function from two returns to one string to show sku and dimensions in WooCommerce cart?
- Call WC_Product get_price()?
- Changing the order of custom fields in the dashboard for Woocommerce variable products [closed]
- woocommerce wc_create_order(); is creating multiple orders instead of one?
- Include js script ONLY on woocommerce product category pages? [closed]
- How to work Woocommerce pagination inside shortcode?
- How to restrict shipping zone in a specific interval time
- Hide specific product from Woocommerce if the logged-in user has already enrolled into the course
- Payment field disappears on custom Paypal plugin
- Creating a brand attribute as a variable
- Convert a column of a table containing an Array as response in HTML
- Display custom field value in woocommerce variable product via jQurey
- I am having errors with checkout on wordpress
- Billing detail page doesn’t work after I’ve changed the order of the Woocommerce navigation
- Change the URL of an image from wp_get_attachment_image_src for Product Posts based on Category
- Combine change Email WordPress and woocommerce emails template
- get orders of today’s date
- product_type_options get saved value [closed]
- Programmatically add a product to the cart and set price to zero when buying from certain category
- I want to show cart items number if any or nothing, simple CART text
- How to retrieve quantity input field by id in woocommerce
- Woocommerce Product page add on checkbox and price
- How to set Nav as a default menu in wordpress
- Using zip code to display custom data in Admin Order Details
- How can I update the price when someone enters postcode or zip code in woocommerce checkout page?
- Add to cart quantity dynamic
- Woocommerce – get daily sales meta
- Custom woocommerce payment gateway – Form
- Discount in the specific product title using keyword ( Woocoommerce )
- Place product field value as variable in php
- Change WooCommerce currency programmatically on AJAX request
- Woocommerce textarea format ignored
- i want add conditional for add category in wordpress
- How can I add another row to the total field in WooCoommerce cart, checkout and recipe mail?
- append data to mysql table via submit button coded in php – not working
- random woocommerce categories are not showing when count enabled?
- Put a span class in the shortened product title
- Add missing alt tag to featured images for “storefront” theme
- How to limit functionality of a woocommerce plugin to only certain user role?
- PHP – Woocommerce 3.2 Add variable shipping insurance with multiple “else if ” conditions
- Sort WooCommerce data with WP-CRON?
- Display specific main Sub Nav on Woocommerce product pages
- Clone the “proceed to cart” button and place it above checkout on the cart page, but only appear display size is 320px
- how to display woocomerce description of each category in wordpress? [closed]
- Use PHP code in Menu Admin Section
- WordPress 3.0 PHP Error – notice WordPress_product_Type was called incorrectly
- Need Quick Help With Product Category Page
- Adding my own custom template page but got white page
- How to set up and use a custom upload directory for post type ‘product’
- How to get the rating value of each comment
- wc_add_notice not working on cart page
- How keep woocommerce users separeted in multisite install and keep admins on network
- Exclude specific product tags from related products in WooCommerce 3+ [closed]
- WooCommerce Orders pagination
- Product Category Page in Full Width
- After declaring woocommerce theme support products are no longer displayed
- Replace the image of a product with its video in the shop page
- WCFM Custom form
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- Remove Woocommerce product from cart with ajax/fetch
- Automatically change insurance quantity based on cart total [closed]
- Removing the add to cart button from specific product pages
- Add Woocommerce Customers link to custom admin menu
- Hide ‘Downloadable’ and ‘Virtual’ checkbox options from Woocommerce Variations?
- PayPal button not showing and cannot retrieve order error in PayPal
- Add text below WooCommerce short description if metabox value is true
- Woocomerce custom add to cart button edit functionality [closed]
- Assembly Options at checkout
- How to get default variation ID (woocommerce)