WooCommerce Custom Fields for Variations allows you to provide your customers with all the right information by adding custom fields to each product variation. The first part of this post will cover creating and displaying the custom fields in a product page, adding the custom field data to the cart, and inserting the data in emails and orders. Alternatively if you would prefer not to edit child-WooCommerce files, then you can add the following code to your function.php in your Child Theme which will add the following action onto the ‘woocommerce_after_shop_loop’ hook; View the Product Category page and you’ll soon have added this extra piece of information to your Product Category page which you can use as you like. They give customers the opportunity to configure or provide personalised information for the product. After that, you’re able to customize all parts of your WooCommerce dashboard and rapidly incorporate site information that would usually require manual data entry. Customers can see all the relevant data from the neat table layout, instead of having to scroll down to the long description tabs. © IconicWP Ltd 2015 — 2020 / All Rights Reserved, How to Add Custom Fields to Product Variations in WooCommerce, Start your 14-day free trial of Custom Fields for Variations, Why you might need to display custom fields on the product page, How to add custom fields to product variations in WooCommerce, Roundup: start adding WooCommerce custom fields, You need to provide extra information for the customer. With custom fields, the product is potentially different for every customer. It saves me time. Enhance the shopping experience on your store by allowing customers to personalise your products. Can you make a tuotrial on that ? In this case, it’s technical information but you can use custom product data fields for all kinds of purposes, including: It’s really easy to add WooCommerce custom product data fields. If that’s not the layout you want, then method 2 is for you. Just found the way to adjust it for variable products by changing the “wc_get_product” settings to “variation_id” instead of “product_id”. The file you need to edit (at the time of writing, this may change…) is archive-product.php. Since you have essentially added a custom field to your site, this will not be automatically detected and picked up by Yoast. This is where you identify where you want the field group to appear in your WordPress dashboard. attribute_pa_color = green& attribute_pa_taille = l) but not the value of the custom field. If you’re using a different one, just use their documentation. Just make sure that they’re comma separated without spaces, and you add cf: before each custom field name. Thanks again. I’m using your code to create a custom field in my site. We can do this very easily using the woocommerce_checkout_create_order_line_item action. defined( ‘DOING_AJAX’ ) ) { do_action( ‘woocommerce_after_shop_loop’ ); For the site I am using this on, the woo_after_shop_loop hook reads, “/** Join now (it’s free)! It checks for the total_price parameter that would have been set when the product was added to the cart. 'Please enter a value into the text field', * Add the text field as item data to the cart object. Have a good look around, it should hopefully become clear with a bit more looking . I’m testing this script (in functions.php file) and works OK, but for the products that don’t have a custom field assigned in the back-end (so no custom text field is displayed on the front-end product page), the validation keeps failing and the clients is getting the warning “Please enter a value into the text field” every time they want to add a product to the cart. If anyone could assist me with this, it would be greatly appreciated . If it’s set, then it adds the title field to the product name as displayed in the cart. You can also add or remove custom fields as needed. I want to be able to upload custom add on information for each product as I bulk upload through the product importer but not seeing how at the moment. As indicated by BuiltWith, WooCommerce controls over 42% of every single online store. I’d recommend contacting the theme developer to see if they can point you in the right direction as this works out of the box. You don’t have to be a developer to put your own stamp on product pages thanks to a few extensions from WooCommerce (and one core WooCommerce feature). Any suggestions where to look / how to fix this?? We provide these blog posts to help people and companies like yourself with common problems and challenges. Thanks! This is just to help you organize the WooCommerce custom fields. I can’t recall off the top of my head exactly how you do this though. Here is the necessary part of my code: This might confuse the customer. On the front end, the extra product data fields will be displayed in a table format like this: You can add as many extra product data fields as you like. By default, WooCommerce displays Product Category content above the products which are listed. Choose ‘Information’ as the ‘Field Type’. Your online store might require custom fields for a number of unique reasons. Thanks for this info. In addition to this, your security software might have different variations of the same product that require you to provide unique information. If yes, would you share it? $value[‘data’]->set_price( ( $price ) ); This WooCommerce extension offers a great way to manage custom fields on your WooCommerce checkout page. I can’t get the current item key from the cart. Thank you very much for this, it works very well! You can easily find this by looking at the URL of the ‘Edit Product’ page where you’re adding the product table shortcode. When used well, adding custom fields to your individual product variations can not only make your customer’s experience better but yours too. So is there a way to have the custom field be sent by solely a link??? You can add costs, subtract costs, and use conditional logic. I am having an issue, the products on our site are marked as “Sold individually” as you can see here in the screenshot: http://prntscr.com/m0oefm. Here’s the code to display the custom field on the product page: This function creates a $product object based on the product ID so that it can look in the product meta data for a value for the custom_text_field_title field.