{"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>\nSamotn\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>\nPrvn\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