tady <\/a>. N\u00e1prava na\u0161t\u011bst\u00ed nen\u00ed slo\u017eit\u00e1, i kdy\u017e mi to chv\u00edli zabralo, ne\u017e jsem na to p\u0159i\u0161el.<\/p>\nP\u016fvodn\u00ed vytvo\u0159en\u00ed custom order status byl ve vytvo\u0159en\u00ed nov\u00e9ho termu. V podstat\u011b sta\u010dilo pou\u017e\u00edt tuto funkci<\/p>\n
function add_custom_status(){\n $term = get_term_by( 'name', 'Custom status', 'shop_order_status' );\n if ( ! $term ) {\n wp_insert_term( 'Custom status', 'shop_order_status' );\n }\n }\n<\/pre>\nV polovin\u011b z\u00e1\u0159\u00ed se v\u0161ak pou\u017eit\u00ed termu zm\u011bnilo na status postu. Objedn\u00e1vky ve WooCommerce jsou vlastn\u011b custom post type a jsou tak ukl\u00e1d\u00e1ny do tabulky wp_posts (wp_ dle aktu\u00e1ln\u00edho prefixu). A stavy objedn\u00e1vek tak byly taxonomie pro custom post type.
\nV r\u00e1mci zjednodu\u0161en\u00ed p\u0159\u00edstupu ke stav\u016fm, se v\u00fdvoj\u00e1\u0159i rozhodli vytvo\u0159it custom post statusy, kter\u00e9 budou m\u00edt prefix wc. Tak\u017ee objedn\u00e1vka ve stavu \u010dekaj\u00edc\u00ed, m\u00e1 v nyn\u00ed post status wc-pending. A v tom je zakopan\u00fd pes.<\/p>\n
Custom order status ve WooCommerce nov\u011b vytvo\u0159\u00edte takto<\/p>\n
add_action( 'init', 'register_custom_order_status', 5 );\n\n function register_custom_order_status(){\n register_post_status( 'wc-control', array(\n\t\t\t'label' => _x( 'Custom status', 'Order status', 'woocommerce' ),\n\t\t\t'public' => true,\n\t\t\t'exclude_from_search' => false,\n\t\t\t'show_in_admin_all_list' => true,\n\t\t\t'show_in_admin_status_list' => true,\n\t\t\t'label_count' => _n_noop( 'Control order (%s)<\/span>', 'Control order (%s)<\/span>', 'woocommerce' )\n\t\t) );\n }\n<\/pre>\nSamoz\u0159ejm\u011b v\u0161ude, kde program\u00e1to\u0159i pou\u017eili pro v\u00fdpis objedn\u00e1vek s vlastn\u00edm statusem, je pot\u0159eba upravit funkce, aby m\u00edsto termu pou\u017e\u00edvaly post_status.<\/p>\n
Douf\u00e1m, \u017ee v\u00e1m tip pom\u016f\u017ee, proto\u017ee na webu jsou nyn\u00ed dohledateln\u00e9 sp\u00ed\u0161e star\u0161\u00ed n\u00e1vody.<\/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":"V \u0159\u00edjnu byla vyd\u00e1na aktualizace WooCommerce, kter\u00e1 v sob\u011b m\u011bla jednu nep\u0159\u00edjemnou zm\u011bnu a to odli\u0161n\u00fd p\u0159\u00edstup k definov\u00e1n\u00ed statusu objedn\u00e1vky. Bohu\u017eel je tato zm\u011bna zp\u011btn\u011b nekompatibiln\u00ed a \u0159ada funkc\u00ed, nebo plugin\u016f, kter\u00e9 toto v sob\u011b maj\u00ed, m\u016f\u017ee b\u00fdt nefunk\u010dn\u00ed. Na to, \u017ee tv\u016frci plugin\u016f budou hned upravovat sv\u00e9 produkty se nem\u016f\u017eete spolehnout, viz. tady<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,25,29],"tags":[109,404],"class_list":["post-2056","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-woocommerce","category-woocommerce-snippety","tag-custom-order-status","tag-vlastni-status-objednavky"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2056"}],"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=2056"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2056\/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=2056"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2056"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2056"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}