{"id":2093,"date":"2014-10-19T20:10:34","date_gmt":"2014-10-19T20:10:34","guid":{"rendered":"http:\/\/musilda.cz\/?p=2093"},"modified":"2014-10-19T20:10:34","modified_gmt":"2014-10-19T20:10:34","slug":"ulozeni-custom-fields-k-objednavce-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/ulozeni-custom-fields-k-objednavce-ve-woocommerce\/","title":{"rendered":"Ulo\u017een\u00ed custom fields k objedn\u00e1vce ve WooCommerce"},"content":{"rendered":"

Pokud pot\u0159ebujete ulo\u017eit spole\u010dn\u011b s objedn\u00e1vkou vlastn\u00ed data, pom\u016f\u017ee v\u00e1m n\u00e1sleduj\u00ed snippet. Pomoc\u00ed n\u011bj ulo\u017e\u00edte custom field pro aktu\u00e1ln\u011b vytvo\u0159enou objedn\u00e1vku. Funkce \u0159e\u0161\u00ed pouze ulo\u017een\u00ed, ne jak data z\u00edsk\u00e1te a jak jej zobraz\u00edte v administraci.<\/p>\n

<\/p>\n

add_action( 'woocommerce_checkout_update_order_meta', 'my_custom_checkout_field_update_order_meta' );\n\nfunction my_custom_checkout_field_update_order_meta( $order_id ) {\n    if ( ! empty( $_POST['my_field_name'] ) ) {\n        update_post_meta( $order_id, 'My Field', sanitize_text_field( $_POST['my_field_name'] ) );\n    }\n}\n<\/pre>\n\n\n

Dal\u0161\u00ed u\u017eite\u010dn\u00e9 snippety najdete na str\u00e1nce U\u017eite\u010dn\u00e9 snippety pro WooCommerce<\/a><\/strong> <\/p>\n","protected":false},"excerpt":{"rendered":"

Pokud pot\u0159ebujete ulo\u017eit spole\u010dn\u011b s objedn\u00e1vkou vlastn\u00ed data, pom\u016f\u017ee v\u00e1m n\u00e1sleduj\u00ed snippet. Pomoc\u00ed n\u011bj ulo\u017e\u00edte custom field pro aktu\u00e1ln\u011b vytvo\u0159enou objedn\u00e1vku. Funkce \u0159e\u0161\u00ed pouze ulo\u017een\u00ed, ne jak data z\u00edsk\u00e1te a jak jej zobraz\u00edte v administraci.<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[19,25,29],"tags":[],"class_list":["post-2093","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-woocommerce","category-woocommerce-snippety"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2093"}],"collection":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/comments?post=2093"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2093\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/8732"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=2093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}