{"id":12182256,"date":"2020-04-23T16:29:07","date_gmt":"2020-04-23T13:29:07","guid":{"rendered":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%b2%d1%8b%d0%b2%d0%b5%d1%81%d1%82%d0%b8-custom-field-%d0%b2-%d0%bf%d1%80%d0%be%d0%b4%d1%83%d0%ba%d1%82%d0%b5\/"},"modified":"2020-04-23T16:29:07","modified_gmt":"2020-04-23T13:29:07","slug":"%d0%b2%d1%8b%d0%b2%d0%b5%d1%81%d1%82%d0%b8-custom-field-%d0%b2-%d0%bf%d1%80%d0%be%d0%b4%d1%83%d0%ba%d1%82%d0%b5","status":"publish","type":"topic","link":"https:\/\/ru.wordpress.org\/support\/topic\/%d0%b2%d1%8b%d0%b2%d0%b5%d1%81%d1%82%d0%b8-custom-field-%d0%b2-%d0%bf%d1%80%d0%be%d0%b4%d1%83%d0%ba%d1%82%d0%b5\/","title":{"rendered":"\u0412\u044b\u0432\u0435\u0441\u0442\u0438 custom field \u0432 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0435"},"content":{"rendered":"<p>\u0425\u044d\u043b\u043f \u0440\u0435\u0431\u044f\u0442\u0430,<br \/>\n\u0432\u044b\u0432\u0435\u043b \u0434\u043e\u043f \u043f\u043e\u043b\u0435 \u0432 \u0430\u0434\u043c\u0438\u043d\u043a\u0435 \u0442\u043e\u0432\u0430\u0440\u0430 (\u0441\u043c <a href=\"https:\/\/drive.google.com\/file\/d\/14ArDfQUjxPCrOiIHfK7TOS-vqYjHGEr9\/view?usp=sharing\">\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443<\/a>) . \u043a\u043e\u0434 \u0442\u0430\u043a\u043e\u0439<\/p>\n<pre><code>function cfwc_create_custom_field() {\n\t$args = array(\n\t\t&#039;id&#039;            =&gt; &#039;custom_text_field_title&#039;,\n\t\t&#039;label&#039;         =&gt; __( &#039;Custom Text Field Title&#039;, &#039;cfwc&#039; ),\n\t\t&#039;class&#039;\t\t\t\t\t=&gt; &#039;cfwc-custom-field&#039;,\n\t\t&#039;desc_tip&#039;      =&gt; true,\n\t\t&#039;description&#039;   =&gt; __( &#039;Enter the title of your custom text field.&#039;, &#039;ctwc&#039; ),\n\t);\n\twoocommerce_wp_text_input( $args );\n}\nadd_action( &#039;woocommerce_product_options_general_product_data&#039;, &#039;cfwc_create_custom_field&#039; );\nfunction cfwc_save_custom_field( $post_id ) {\n\t$product = wc_get_product( $post_id );\n\t$title = isset( $_POST[&#039;custom_text_field_title&#039;] ) ? $_POST[&#039;custom_text_field_title&#039;] : &#039;&#039;;\n\t$product-&gt;update_meta_data( &#039;custom_text_field_title&#039;, sanitize_text_field( $title ) );\n\t$product-&gt;save();\n}\nadd_action( &#039;woocommerce_process_product_meta&#039;, &#039;cfwc_save_custom_field&#039; );<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c php \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (Price 37.5euro) \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u043e\u0432 \u0438 \u0432 single product (\u0441\u043c <a href=\"https:\/\/drive.google.com\/file\/d\/1lqwe-UuSPO0n5UD9ApaCPaL5wHxrleEY\/view?usp=sharing\">\u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443<\/a>) \u0438 \u0447\u0442\u043e\u0431\u044b \u0431\u044b\u043b class css \u0443 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438. \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043a\u043e\u0440\u0437\u0438\u043d\u044b. \u042d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433.<\/p>\n","protected":false},"template":"","class_list":["post-12182256","topic","type-topic","status-publish","hentry","topic-tag-11004","topic-tag-15876","topic-tag-2048"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12182256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/12182256\/revisions"}],"wp:attachment":[{"href":"https:\/\/ru.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=12182256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}