You can use the $posted
parameter to get the right value in your function.
add_action('woocommerce_checkout_update_order_meta',function( $order_id, $posted ) {
$order = wc_get_order( $order_id );
$order->update_meta_data( 'recipient_email', $posted['recipient_email'] );
$order->save();
} , 10, 2);
Verify that $posted is an array not an object with a var_dump on $posted.
if it’s an object replace $posted['recipient_email']
with $posted->recipient_email
Hope it helps 🙂
Related Posts:
- Set attached to state
- How to change ID of an attachment in wp_posts and its related tables correctly?
- Add multiple attributes to product from php
- Woocommerce email template customization [closed]
- How to send an automated email to the customers when product is added woocommerce
- Redirect to another page using contact form 7? [closed]
- Is it possible to send blog posts via email to subscribers?
- Set Multiple Meta Values as an Array Using dispatch( ‘core/editor’ ).editPost() Call in Gutenberg/JS
- How can I concatenate variables to search results title? [closed]
- Function added to hook “new_to_publish” not executing – custom plugin
- Link Posts to External URL
- What snippet do I need to type to show my ACF field show up on my theme?
- Is there a way to make [Table Of Content] plugin while not using revision data?
- Help to Create a Simple Plugin to make a post
- “Enable Media Replace” plugin does not update serialized object in WPMeta
- WordPress eMails not working
- How to Save settings of custom tab product page in admin side in a database?
- Get post id in Post Page within Wp-admin
- Send Processing Order Email from custom payment plugin
- how to add meta for order in woocommerce
- Show WooCommerce products based on query parameters on redirect
- additional fields based on the quantity of products selected
- wp_mail and BCC headers
- Email Notifications of new posts to users – suggestions [closed]
- WooCommerce ‘all’ orders no longer being displayed – how may I debug/fix [closed]
- Create WooCommerce Product Category Programmatically
- How to save Clicks of a download link button while it doesn’t matter if we refresh the page or again login/logout
- Publish Post After Click On A Link
- WooCommerce Dynamic Cart Pricing
- Enable comments for post with comments meta box removed
- Is there an action that is called when a post is restored from the trash?
- plugin for wp_list_categories with posts
- WP Mail SMTP: What do the SSL/TLS options mean? [closed]
- Replace existing pages with new pages, keep menu links
- Adding “ ” before the last word in multiple defined areas with a plugin
- Is there a plugin to record querystring parameters for a page (for customer tracking)? [closed]
- New post notification plugin [closed]
- Adding Plugin-specific Fields with wp_insert_post()?
- Check if email address exists front end with AJAX in a plugin
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- Override Javascript in a Plugin?
- Woocommerce – How to populate custom select field with stored values on checkout page?
- Can’t delete Draft Post [closed]
- WordPress automatically removes line break
- Fetch Children of Grouped Products Inside WooCommerce Product Loop
- Outbound link autometic converted into linkdirect , and not opening
- WooCommerce: Building a page with user input which is used to query order status and external API and return a result
- How to toggle between two custom fields in WordPress woocommerce ‘WC Product Field Group’ plugin?
- Looking for a way that will collect visitors emails before letting them view the blog posts [closed]
- Contributive page where people logged in can write
- How to add checkboxes for a woocommerce product? [closed]
- Why am I getting ( WooCommerce Services could not be installed (Could not create directory.). ) error and how to solve it ?
- how to do login using woocommerce rest api From android
- Woocommerce Shop page variation product button replace with add to cart button
- woocommerce with custom post type
- AJAX fileupload – TypeError: not a function ajaxSubmit()
- Problem of encoding characters (apostrophes) in my posts publications
- How to backup single post in wordpress [closed]
- How to change the post form from plugin?
- Allowing users to Sign-up > Login > Post articles that need approval
- WooCommerce – set session with new cart item meta when updating cart item quantity [closed]
- Adding custom meta boxes to specified custom post type
- Conditional Shipping Options if Certain Products are in Cart WooCommerce
- Woocommerce Backend Search by Title and SKU
- Woocommerce singe product custom gallery output works just on the first slide
- How to include a custom field in the woocommerce email?
- Remove Pagination for Product Category Pages WooCommerce
- Is there a plugin or a way in the wordpress that would let us have different versions of a post or page accessibe to users?
- add seperate suffix for low price and high price in woocommerce
- Get products list by url key in WordPress Woocommerce [closed]
- Send post changes to set email addresses (not users or subscribers)
- How to return a specific attribute
- Is it possible to pin a post in second position from top
- How to display emails as a post?
- Visual composer custom element error
- Plugin which unlock free gift when you reach some amount in cart
- Optimise wordpress database using SQL after deleting registered images from Media Folder
- is there a way to display product gallery images via cdn
- Changing the Default New User Notification Email
- How to assign a specific service to a specific provider based on location
- How can I see $post object in frontend from functions.php?
- Allow members to create groups on my site
- Object of class WP_Error could not be converted to string in /formatting.php
- Many to many relationship for variable products
- Add dynamic color to each category item
- Publish Post but don’t call publish hook in foreground post creation
- get post excerpt by query
- Add meta tags with a plugin?
- WordPress User Frontend Editing Custom Fields
- Add A Button to WooCommerce Product Page
- How ACF Advanced Custom Field works with Woocommerce Single Product [closed]
- The plugin generated xxx characters of unexpected output during activation
- How to work email subscribe in WordPress?
- WP Customer Reviews call short code on another page [closed]
- Need help saving input fields for Security Deposit plugin in WC Vendors page
- Populate Woocommerce order notes with custom field value
- Woocommerce Product Add-ons – Auto-select first option
- Shortcode returning specific content of a post
- Display out of stock products in WooCommerce [closed]
- How to update a lot of posts on my WP site with additional content?