{"id":9012,"date":"2021-06-04T09:16:32","date_gmt":"2021-06-04T09:16:32","guid":{"rendered":"https:\/\/eoxysit.com\/?p=9012"},"modified":"2025-01-21T11:25:05","modified_gmt":"2025-01-21T11:25:05","slug":"magic-of-woocommerce-products-custom-fields","status":"publish","type":"post","link":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/","title":{"rendered":"Magic of WooCommerce Products Custom Fields"},"content":{"rendered":"\n<h1>Magic of WooCommerce Products Custom Fields<\/h1>\n<section class=\"elementor-section elementor-top-section elementor-element elementor-element-8052452 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"8052452\" data-element_type=\"section\">\n<div class=\"elementor-container elementor-column-gap-default\">\n<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-87d9f55\" data-id=\"87d9f55\" data-element_type=\"column\">\n<div class=\"elementor-widget-wrap elementor-element-populated\">\n<div class=\"elementor-element elementor-element-af63ab5 elementor-widget elementor-widget-text-editor\" data-id=\"af63ab5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-text-editor elementor-clearfix\">\n<p>WooCommerce is without any doubt the more powerful e-commerce plugin for WordPress. And what i love with WooCommerce is that there\u2019s an API for nearly everything. Today, i decided to show you how you can customize WooCommerce dynamically, and in particular how to add custom fields to any WooCommerce products. Here is the final result of what you\u2019ll learn to do in this post:<\/p>\n<figure><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-1547 aligncenter\" src=\"https:\/\/expertwebtechnologies.com\/blogs\/wp-content\/uploads\/2020\/02\/mastering-woocommerce-product-fields-300x256.png\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" srcset=\"https:\/\/expertwebtechnologies.com\/blogs\/wp-content\/uploads\/2020\/02\/mastering-woocommerce-product-fields-300x256.png 300w, https:\/\/expertwebtechnologies.com\/blogs\/wp-content\/uploads\/2020\/02\/mastering-woocommerce-product-fields-500x427.png 500w, https:\/\/expertwebtechnologies.com\/blogs\/wp-content\/uploads\/2020\/02\/mastering-woocommerce-product-fields.png 616w\" alt=\"\" width=\"300\" height=\"256\"><\/figure><p><\/p>\n<p>As you can on the screenshot above we will see how to add custom fields to the product edition page. To do that we will be working on the functions.php file of your theme\u2019s folder only.<br>\nTo begin we will add custom fields to the product general tab, we will see later how to add custom fields to the other tabs, and how to create your own tabs.<\/p>\n<p>The right hooks<br>\nThe first step is to hook an action to woocommerce_product_options_general_product_data. The function linked to this hook will be responsible of the new fields display. A second hook will be taken into account to save fields values: woocommerce_process_product_meta. Basically these two actions will be done using that code:<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ef8125a elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ef8125a\" data-element_type=\"section\">\n<div class=\"elementor-container elementor-column-gap-default\">\n<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-09ba2e4\" data-id=\"09ba2e4\" data-element_type=\"column\">\n<div class=\"elementor-widget-wrap elementor-element-populated\">\n<div class=\"elementor-element elementor-element-ef31621 elementor-widget elementor-widget-html\" data-id=\"ef31621\" data-element_type=\"widget\" data-widget_type=\"html.default\">\n<div class=\"elementor-widget-container\">\/\/ Display Fields<br>\nadd_action( &#8216;woocommerce_product_options_general_product_data&#8217;, &#8216;woo_add_custom_general_fields&#8217; );<br>\n\/\/ Save Fields<br>\nadd_action( &#8216;woocommerce_process_product_meta&#8217;, &#8216;woo_add_custom_general_fields_save&#8217; );<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"elementor-section elementor-top-section elementor-element elementor-element-9da41cf elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"9da41cf\" data-element_type=\"section\">\n<div class=\"elementor-container elementor-column-gap-default\">\n<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-d3ee5f4\" data-id=\"d3ee5f4\" data-element_type=\"column\">\n<div class=\"elementor-widget-wrap elementor-element-populated\">\n<div class=\"elementor-element elementor-element-c9d8bd0 elementor-widget elementor-widget-heading\" data-id=\"c9d8bd0\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n<div class=\"elementor-widget-container\">\n<h2 class=\"elementor-heading-title elementor-size-default\">Adding New Fields<\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n\n\n\n<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5277209 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5277209\" data-element_type=\"section\">\n<div class=\"elementor-container elementor-column-gap-default\">\n<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-09bdb52\" data-id=\"09bdb52\" data-element_type=\"column\">\n<div class=\"elementor-widget-wrap elementor-element-populated\">\n<div class=\"elementor-element elementor-element-1493b09 elementor-widget elementor-widget-text-editor\" data-id=\"1493b09\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n<div class=\"elementor-widget-container\">\n<div class=\"elementor-text-editor elementor-clearfix\">\n<p>The snippet above link two custom functions to the right hooks. Now we need to create those functions. Let\u2019s start bye the first one, woo_add_custom_general_fields(), that will create the fields. Here is how the function will look like<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>Magic of WooCommerce Products Custom Fields WooCommerce is without any doubt the more powerful e-commerce plugin for WordPress. And what i love with WooCommerce is that there\u2019s an API for nearly everything. Today, i decided to show you how you can customize WooCommerce dynamically, and in particular how to add custom fields to any WooCommerce [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":17106,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37,34,35,36],"tags":[],"class_list":["post-9012","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-custom-field","category-woocommerce","category-woocommerce-hooks","category-wordpress"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Magic of WooCommerce Products Custom Fields<\/title>\n<meta name=\"description\" content=\"Discover the magic of WooCommerce product custom fields! Learn how to add, manage, and utilize custom fields to enhance your store&#039;s functionality and user experience.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Magic of WooCommerce Products Custom Fields\" \/>\n<meta property=\"og:description\" content=\"Discover the magic of WooCommerce product custom fields! Learn how to add, manage, and utilize custom fields to enhance your store&#039;s functionality and user experience.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\" \/>\n<meta property=\"og:site_name\" content=\"EoXys IT\" \/>\n<meta property=\"article:published_time\" content=\"2021-06-04T09:16:32+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-01-21T11:25:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"359\" \/>\n\t<meta property=\"og:image:height\" content=\"358\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"Shiv kumawat\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shiv kumawat\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\"},\"author\":{\"name\":\"Shiv kumawat\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/534245eb0e092114ff5b6d0d877af61e\"},\"headline\":\"Magic of WooCommerce Products Custom Fields\",\"datePublished\":\"2021-06-04T09:16:32+00:00\",\"dateModified\":\"2025-01-21T11:25:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\"},\"wordCount\":281,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp\",\"articleSection\":[\"Custom Field\",\"Woocommerce\",\"Woocommerce Hooks\",\"WordPress\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\",\"url\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\",\"name\":\"Magic of WooCommerce Products Custom Fields\",\"isPartOf\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp\",\"datePublished\":\"2021-06-04T09:16:32+00:00\",\"dateModified\":\"2025-01-21T11:25:05+00:00\",\"author\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/534245eb0e092114ff5b6d0d877af61e\"},\"description\":\"Discover the magic of WooCommerce product custom fields! Learn how to add, manage, and utilize custom fields to enhance your store's functionality and user experience.\",\"breadcrumb\":{\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage\",\"url\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp\",\"contentUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp\",\"width\":359,\"height\":358,\"caption\":\"Web Design\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/eoxysit.com\/blogs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Magic of WooCommerce Products Custom Fields\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#website\",\"url\":\"https:\/\/eoxysit.com\/blogs\/\",\"name\":\"EoXys IT\",\"description\":\"Digitise your business\",\"alternateName\":\"Eoxys It\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/eoxysit.com\/blogs\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/534245eb0e092114ff5b6d0d877af61e\",\"name\":\"Shiv kumawat\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png\",\"contentUrl\":\"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png\",\"caption\":\"Shiv kumawat\"},\"description\":\"\\\"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company\\\"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.\u201d\",\"sameAs\":[\"https:\/\/eoxysit.com\/\"],\"url\":\"https:\/\/eoxysit.com\/blogs\/author\/shivkumawat1985\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Magic of WooCommerce Products Custom Fields","description":"Discover the magic of WooCommerce product custom fields! Learn how to add, manage, and utilize custom fields to enhance your store's functionality and user experience.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/","og_locale":"en_US","og_type":"article","og_title":"Magic of WooCommerce Products Custom Fields","og_description":"Discover the magic of WooCommerce product custom fields! Learn how to add, manage, and utilize custom fields to enhance your store's functionality and user experience.","og_url":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/","og_site_name":"EoXys IT","article_published_time":"2021-06-04T09:16:32+00:00","article_modified_time":"2025-01-21T11:25:05+00:00","og_image":[{"width":359,"height":358,"url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp","type":"image\/webp"}],"author":"Shiv kumawat","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Shiv kumawat","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#article","isPartOf":{"@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/"},"author":{"name":"Shiv kumawat","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/534245eb0e092114ff5b6d0d877af61e"},"headline":"Magic of WooCommerce Products Custom Fields","datePublished":"2021-06-04T09:16:32+00:00","dateModified":"2025-01-21T11:25:05+00:00","mainEntityOfPage":{"@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/"},"wordCount":281,"commentCount":0,"image":{"@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp","articleSection":["Custom Field","Woocommerce","Woocommerce Hooks","WordPress"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/","url":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/","name":"Magic of WooCommerce Products Custom Fields","isPartOf":{"@id":"https:\/\/eoxysit.com\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage"},"image":{"@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage"},"thumbnailUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp","datePublished":"2021-06-04T09:16:32+00:00","dateModified":"2025-01-21T11:25:05+00:00","author":{"@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/534245eb0e092114ff5b6d0d877af61e"},"description":"Discover the magic of WooCommerce product custom fields! Learn how to add, manage, and utilize custom fields to enhance your store's functionality and user experience.","breadcrumb":{"@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#primaryimage","url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp","contentUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2021\/06\/Untitled-23.webp","width":359,"height":358,"caption":"Web Design"},{"@type":"BreadcrumbList","@id":"https:\/\/eoxysit.com\/blogs\/magic-of-woocommerce-products-custom-fields\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/eoxysit.com\/blogs\/"},{"@type":"ListItem","position":2,"name":"Magic of WooCommerce Products Custom Fields"}]},{"@type":"WebSite","@id":"https:\/\/eoxysit.com\/blogs\/#website","url":"https:\/\/eoxysit.com\/blogs\/","name":"EoXys IT","description":"Digitise your business","alternateName":"Eoxys It","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/eoxysit.com\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/534245eb0e092114ff5b6d0d877af61e","name":"Shiv kumawat","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/eoxysit.com\/blogs\/#\/schema\/person\/image\/","url":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png","contentUrl":"https:\/\/eoxysit.com\/blogs\/wp-content\/uploads\/2025\/03\/CEO-150x150.png","caption":"Shiv kumawat"},"description":"\"Shiv kumawat is the Executive Director and CEO of Eoxys It Solution LLP and the strategic mind behind the company\"s growth. His expertise in operational efficiency and team leadership empowers his colleagues to excel and innovate.\u201d","sameAs":["https:\/\/eoxysit.com\/"],"url":"https:\/\/eoxysit.com\/blogs\/author\/shivkumawat1985\/"}]}},"_links":{"self":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts\/9012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/comments?post=9012"}],"version-history":[{"count":0,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/posts\/9012\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/media\/17106"}],"wp:attachment":[{"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/media?parent=9012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/categories?post=9012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eoxysit.com\/blogs\/wp-json\/wp\/v2\/tags?post=9012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}