{"id":6431,"date":"2021-10-28T11:23:00","date_gmt":"2021-10-28T11:23:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6431"},"modified":"2021-10-28T11:23:00","modified_gmt":"2021-10-28T11:23:00","slug":"uprava-kroku-mnozstvi-pro-pridani-do-kosiku","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/uprava-kroku-mnozstvi-pro-pridani-do-kosiku\/","title":{"rendered":"\u00daprava kroku mno\u017estv\u00ed pro p\u0159id\u00e1n\u00ed do ko\u0161\u00edku"},"content":{"rendered":"\n
Setkal jsem se s po\u017eadavkem, kdy klient cht\u011bl, aby bylo mo\u017en\u00e9 upravit krok input pro p\u0159id\u00e1n\u00ed do ko\u0161\u00edku. Tedy, aby m\u00edsto jednoho kusu, bylo mno\u017estv\u00ed navy\u0161ov\u00e1no po deseti kusech<\/p>\n\n\n\n
Proto\u017ee WooCommerce pou\u017e\u00edv\u00e1 pro tento p\u0159\u00edpad funkci woocommerce_quantity_input, sta\u010d\u00ed pomoc\u00ed filtru o\u0161et\u0159it krok number inputu. <\/p>\n\n\n\n
Snippet pak vypad\u00e1 n\u00e1sledovn\u011b:<\/p>\n\n\n\n
add_filter( 'woocommerce_quantity_input_step', 'custom_product_qty_step', 10, 2 );\nfunction custom_product_qty_step( $qty, $product ) {\n\n\t$qty = 10;\n\n\treturn $qty;\n\n}<\/code><\/pre>\n\n\n\nProm\u011bnn\u00e1 $product v sob\u011b m\u00e1 objekt produktu, tak\u017ee jste pom\u011brn\u011b jednodu\u0161e schopni omezovat \u00fapravu kroku na produkty t\u0159eba v konkr\u00e9tn\u00ed kategorii. <\/p>\n","protected":false},"excerpt":{"rendered":"
Setkal jsem se s po\u017eadavkem, kdy klient cht\u011bl, aby bylo mo\u017en\u00e9 upravit krok input pro p\u0159id\u00e1n\u00ed do ko\u0161\u00edku. Tedy, aby m\u00edsto jednoho kusu, bylo mno\u017estv\u00ed navy\u0161ov\u00e1no po deseti kusech Proto\u017ee WooCommerce pou\u017e\u00edv\u00e1 pro tento p\u0159\u00edpad funkci woocommerce_quantity_input, sta\u010d\u00ed pomoc\u00ed filtru o\u0161et\u0159it krok number inputu. Snippet pak vypad\u00e1 n\u00e1sledovn\u011b: Prom\u011bnn\u00e1 $product v sob\u011b m\u00e1 objekt produktu,<\/p>\n","protected":false},"author":1,"featured_media":5600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29],"tags":[],"class_list":["post-6431","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce-snippety"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6431"}],"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=6431"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6431\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/5600"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=6431"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6431"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6431"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}