{"id":1514,"date":"2014-02-04T21:42:42","date_gmt":"2014-02-04T21:42:42","guid":{"rendered":"http:\/\/musilda.cz\/?p=1514"},"modified":"2014-02-04T21:42:42","modified_gmt":"2014-02-04T21:42:42","slug":"pridani-ic-a-dic-do-objednavky-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/pridani-ic-a-dic-do-objednavky-woocommerce\/","title":{"rendered":"P\u0159id\u00e1n\u00ed I\u010c a DI\u010c do objedn\u00e1vky Woocommerce"},"content":{"rendered":"

Ned\u00e1vno se m\u011b n\u011bkdo v koment\u00e1\u0159\u00edch ptal, zda nezn\u00e1m zp\u016fsob, jak p\u0159idat do procesu objedn\u00e1vky veWoocommerce pol\u00ed\u010dka pro I\u010c a DI\u010c. Proto bude dne\u0161n\u00ed tip pro Woocommerce, pr\u00e1v\u011b zp\u016fsob, jak roz\u0161\u00ed\u0159it formul\u00e1\u0159 pro formul\u00e1\u0159 s faktura\u010dn\u00ed adresou.<\/p>\n

Nebudu to nijak natahovat, postup je jednoduch\u00fd a vyu\u017e\u00edv\u00e1 filtru woocommerce_checkout_fields, kter\u00fd je v pluginu k dispozici.<\/p>\n

Funkce, kterou vlo\u017e\u00edte do functions.php vypad\u00e1 takto:<\/p>\n

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );\n\nfunction custom_override_checkout_fields( $fields ) {\n     $fields['billing']['billing_ico'] = array(\n    'label'     => __('I\u010c', 'woocommerce'),\n    'placeholder'   => _x('I\u010c', 'placeholder', 'woocommerce'),\n    'required'  => true,\n    'class'     => array('form-row-wide'),\n    'clear'     => true\n     );\n\n     $fields['billing']['billing_dic'] = array(\n    'label'     => __('DI\u010c', 'woocommerce'),\n    'placeholder'   => _x('DI\u010c', 'placeholder', 'woocommerce'),\n    'required'  => false,\n    'class'     => array('form-row-wide'),\n    'clear'     => true\n     );\n\n     return $fields;\n}\n<\/pre>\n

Samotn\u00e9 textov\u00e9 pole formul\u00e1\u0159e definuje toto pole:<\/p>\n

$fields['billing']['billing_ico'] = array(\n    'label'     => __('I\u010c', 'woocommerce'),\n    'placeholder'   => _x('I\u010c', 'placeholder', 'woocommerce'),\n    'required'  => true,\n    'class'     => array('form-row-wide'),\n    'clear'     => true\n     );\n<\/pre>\n

Prvn\u00ed kl\u00ed\u010d ‚billing‘, ur\u010duje, kam bude pol\u00ed\u010dko s n\u00e1zvem ‚billing_ico‘ za\u0159azeno. Pokud budete cht\u00edt p\u0159idat i pole do doru\u010dovac\u00ed adresy, sta\u010d\u00ed zm\u011bnit billing na shipping. Pokud nechcete, aby bylo pol\u00ed\u010dko povinn\u00e9, zm\u011b\u0148te required z true na false.<\/p>\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":"

Ned\u00e1vno se m\u011b n\u011bkdo v koment\u00e1\u0159\u00edch ptal, zda nezn\u00e1m zp\u016fsob, jak p\u0159idat do procesu objedn\u00e1vky veWoocommerce pol\u00ed\u010dka pro I\u010c a DI\u010c. Proto bude dne\u0161n\u00ed tip pro Woocommerce, pr\u00e1v\u011b zp\u016fsob, jak roz\u0161\u00ed\u0159it formul\u00e1\u0159 pro formul\u00e1\u0159 s faktura\u010dn\u00ed adresou. Nebudu to nijak natahovat, postup je jednoduch\u00fd a vyu\u017e\u00edv\u00e1 filtru woocommerce_checkout_fields, kter\u00fd je v pluginu k dispozici. Funkce, kterou<\/p>\n","protected":false},"author":1,"featured_media":1484,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,25,29],"tags":[425],"class_list":["post-1514","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-woocommerce","category-woocommerce-snippety","tag-woocommerce"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1514"}],"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=1514"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/1514\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/1484"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=1514"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=1514"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=1514"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}