Okay found it. It was a silly mistake I overlooked. I had 1 attribute (esc_attr($myField)
) double inside the update_post_meta()
method.
So this function works perfectly:
function woocommerce_save_fields($post_id)
{
$myField = $_POST['field_name'];
if (!empty($myField))
update_post_meta($post_id, 'field_name', esc_attr($myField));
else update_post_meta( $post_id, 'field_name', '' );
}
Related Posts:
- Conditionally run function based on custom meta value?
- How to add custom checkboxes from loop to WooCommerce product variation options?
- acf_form() – “On Update” action [closed]
- WooCommerce: Can’t use wc_get_products for custom REST API endpoints
- How to get rid of the hover zoom in WooCommerce single products
- What’s the difference between WC() and $woocommerce
- Hook and send Woocommerce data after click Place Order button
- WooCommerce conditional meta query
- WooCommerce: How to display item meta data in email confirmation using woocommerce_order_item_meta_end
- Get updated meta data after save_post hook
- Show only geolocated user country into Woocommerce checkout country fields
- Better post meta efficiency?
- post meta data clearing on autosave
- Extend Woocommerce rest api routes fails
- Display info from custom fields in all images’ HTML
- Update meta values with AJAX
- Remove action on product archive page [closed]
- The correct way to override WooCommerce product gallery from a plugin [closed]
- display available size on hover, in woocommerce shop page [closed]
- Customize WooCommerce orders displayed shipping
- How can I show an empty WooCommerce cart? [closed]
- Is there a Woocommerce hook that fires when applying a coupon but before checking if it’s valid?
- What is the action hook for an order that fails on frontend checkout in WooCommerce?
- How to unhook a function in Woocommerce Template?
- WooCommerce: Adding Order Item Meta Data That’s Hidden
- Using a filter with multiple parameters and $this
- Remove Order List Row Link in WooCommerce Admin?
- Get rid of product images mobile swipe functionality from WooCommerce single product [closed]
- Which hook should I use to capture $_POST(‘password’) via profile update and password reset
- Edit WooCommerce product content based on category
- Bulk remove post meta
- How to create html block to display extra information on woocommerce single product page
- woocommerce_package_rates not fired everytime
- differentiate hooks and filters on the same page [closed]
- WP_Query with meta_query for children
- ‘profile_update’ hook alternative for WooCommerce user meta data
- How to add a user custom field into Woocommerce emails?
- Woocommerce custom meta fields, sort by date
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Add Stripe Connect data to wc_stripe_payment_request
- Redirect customer to login page (with other signup plugin) if user not logged in when proceeding to checkout
- How to subscribe free subscription on user registration in woocommerce subscription plugin?
- How to list all WC products by their attributes values?
- Showing the WordPress standard text area on a Woocommerce Single Product Page?
- Woocommerce Moving Review Below add to cart breaks button
- How to upload multiple image using wp_insert_post
- WooCommerce order complete email logic
- Set default value field meta_Value [closed]
- How to override Woocommerce functionality in Reports section?
- how can use woocommerce add to cart popup?
- How to Update the Order-Items While Editing an Order on the WooCommerce Admin Order Screen [closed]
- WooCommerce Hook: Content get’s displayed twice and not AFTER the order total
- Is it possible to update the total price on the checkout page in woocommerce from a custom field
- New field on checkout is shown but it’s not saved on the order details [closed]
- Adding Product Name on Admin Panel Order list and User’s My-Account Order List
- How to re-arrange this hooked content?
- update_post_meta not work [closed]
- How to exclude a taxonomy from shop & search page wooCommerce?
- WooCommerce order refund get qty refunded
- Redirect no product url’s to static url
- Adding a custom Shipping methods field to an order
- What Hook/Action is performed when a field in checkout form is changed in WooCommerce
- How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]
- How can I add a so i can show sale price under normal price
- password_reset doesnt work
- WooCommerce checkout page price break down table hook
- How to output woocommerce products to a page, style and modify the html structure
- Filter default_content only for products
- Woocommerce – Adding row to cart table
- Conditional action hook
- How can I override wp_price woocommerce function in my theme
- WooCommerce Bookings Plugin Not Saving Order ID
- Add a custom class to the body tag using custom fields
- manage_shop_order_posts_custom_column() hook is Not working In Functions.php file in my WordPress active theme
- Display custom product option in admin order details
- Next/Previous Product with custom order by price & products inside the product category [closed]
- WooCommerce Meta
- How to alter taxes amounts when updating an order
- How to check if woocommerce_order_item_name is use in email?
- Hooks For Design variation in woo commerce single product page
- How to add woocommerce products header title in woocommerce_breadcrumb hook to function.php
- Use ID as slug for product category by default in WooCommerce?
- What is the problem with these lines of code?
- data-value for custom woocommerce field showing in code but not visable on page load
- Display custom field value in woocommerce variable product via jQurey
- Access custom meta_data in processing order email
- Woocommerce : Add name filed of checkout page to buyers wordpress display name
- Updating order meta to have a meta entry from an item in the order
- Insert a custom field as a second email address to a completed order in WooCommerce
- dakon show vender address on checkout page
- Hide a shipping method if cart total is higher than an amount
- Add second price option based on payment method at cart item price
- Use a woocommerce hook to create a table and populate it with a query
- Custom fields in the billing address section woocommerce
- Woocommerce send metadata to stripe
- How to modify username before logging in?
- How to add field new in account bacs in woocommerce?
- WooCommerce Webhook Action When a New Product Review was Submitted/Created
- Woocommerce: hide “Price display suffix” when the VAT is zero
- Link post thumbnail image when automatically creating Woocommerce product from a WordPress post