{"id":13612454,"date":"2020-11-02T20:28:27","date_gmt":"2020-11-02T20:28:27","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/woocommerce-custom-field-not-working\/"},"modified":"2020-11-02T20:58:18","modified_gmt":"2020-11-02T20:58:18","slug":"woocommerce-custom-field-not-working","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/woocommerce-custom-field-not-working\/","title":{"rendered":"WooCommerce Custom Field NOT WORKING"},"content":{"rendered":"<p>I added some custom fields for my WooCommerce products, but when I send a GET request I just see the <code>meta_box:[]<\/code> empty, but they appear in the <code>meta_data<\/code> field (see bellow):<\/p>\n<pre><code>&quot;meta_data&quot;: [\n           \n            {\n                &quot;id&quot;: 3927,\n                &quot;key&quot;: &quot;ff-continue_selling_out_of_stock&quot;,\n                &quot;value&quot;: &quot;1&quot;\n            },\n            {\n                &quot;id&quot;: 3928,\n                &quot;key&quot;: &quot;ff-pack_quantity&quot;,\n                &quot;value&quot;: &quot;77&quot;\n            },\n            {\n                &quot;id&quot;: 3929,\n                &quot;key&quot;: &quot;ff-barcode&quot;,\n                &quot;value&quot;: &quot;7777777&quot;\n            }\n        ],\n&quot;meta_box&quot;: [],<\/code><\/pre>\n<p> I have a custom API in a WordPress plugin, so the requests are sent with this path:  <code>localsite\/wp-json\/ff\/v1\/product\/265<\/code> <\/p>\n<p>So, I tested using the normal path <code>localsite\/wp-json\/wp\/v2\/product\/265<\/code> and I get the expected result:<\/p>\n<pre><code>&quot;meta&quot;: [],\n&quot;meta_box&quot;: {\n        &quot;ff-continue_selling_out_of_stock&quot;: &quot;1&quot;,\n        &quot;ff-pack_quantity&quot;: &quot;77&quot;,\n        &quot;ff-barcode&quot;: &quot;7777777&quot;\n    },<\/code><\/pre>\n<p>But if i try to update with a PUT or POST to that normal path <code>localsite\/wp-json\/wp\/v2\/product\/265<\/code> I get an error on postman (see bellow) <\/p>\n<p>POST I send<\/p>\n<pre><code>{\n    &quot;meta_box&quot;: {\n        &quot;ff-pack_quantity&quot;: &quot;66666&quot;,\n        &quot;ff-barcorde&quot;: &quot;1111111&quot;,\n        &quot;ff-continue_selling_out_of_stock&quot;: &quot;0&quot;\n    }\n}<\/code><\/pre>\n<p>Error Response I GET<\/p>\n<pre><code>{\n    &quot;code&quot;: &quot;rest_cannot_edit&quot;,\n    &quot;message&quot;: &quot;Sorry, you are not allowed to edit this post.&quot;,\n    &quot;data&quot;: {\n        &quot;status&quot;: 403\n    }\n}<\/code><\/pre>\n<p>-I need to send the request to the first path <code>localsite\/wp-json\/ff\/v1\/product\/id<\/code> , so what could be the problem, what am i doing wrong? because both ways are not working<\/p>\n<p>Any help would be greatly appreciated<\/p>\n<p>Thanks!<\/p>\n","protected":false},"template":"","class_list":["post-13612454","topic","type-topic","status-publish","hentry","topic-tag-custom-fields"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13612454","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":1,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13612454\/revisions"}],"predecessor-version":[{"id":13612461,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/13612454\/revisions\/13612461"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=13612454"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}