{"id":6599,"date":"2022-01-12T10:27:00","date_gmt":"2022-01-12T10:27:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6599"},"modified":"2022-01-12T10:27:00","modified_gmt":"2022-01-12T10:27:00","slug":"zmena-poctu-kusu-produktu-po-pridani-do-kosiku","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/zmena-poctu-kusu-produktu-po-pridani-do-kosiku\/","title":{"rendered":"Zm\u011bna po\u010dtu kus\u016f produktu po p\u0159id\u00e1n\u00ed do ko\u0161\u00edku"},"content":{"rendered":"\n

WooCommerce p\u0159id\u00e1 do ko\u0161\u00edku p\u0159esn\u011b tolik kus\u016f produktu, kolik jich je aktu\u00e1ln\u011b zvoleno. Av\u0161ak, i toto lze ovlivnit pomoc\u00ed jednoduch\u00e9ho filtru. <\/p>\n\n\n\n

\u0158ekn\u011bme, \u017ee chcete prod\u00e1vat zbo\u017e\u00ed po ur\u010dit\u00e9m po\u010dtu kus\u016f. Po kliknut\u00ed do ko\u0161\u00edku se v\u0161ak p\u0159id\u00e1 jen jeden kus. <\/p>\n\n\n\n

N\u00e1sleduj\u00edc\u00edm k\u00f3dem po\u010det kus\u016f p\u0159idan\u00fdch do ko\u0161\u00edku uprav\u00edte:<\/p>\n\n\n\n

add_filter( 'woocommerce_add_to_cart_quantity', 'musilda_change_add_to_cart_quantity', 10, 2 );\nfunction musilda_change_add_to_cart_quantity( $quantity, $product_id ) {\n\n\tif ( 123 === $product_id ) {\n\t\t$quantity = 6;\n\t}\n\n\treturn $quantity;\n\n}<\/code><\/pre>\n\n\n\n

V p\u0159\u00edpad\u011b, \u017ee se jedn\u00e1 o produkt s id 123, bude do ko\u0161\u00edku p\u0159id\u00e1no 6 kus\u016f a ne jeden.<\/p>\n","protected":false},"excerpt":{"rendered":"

WooCommerce p\u0159id\u00e1 do ko\u0161\u00edku p\u0159esn\u011b tolik kus\u016f produktu, kolik jich je aktu\u00e1ln\u011b zvoleno. Av\u0161ak, i toto lze ovlivnit pomoc\u00ed jednoduch\u00e9ho filtru. \u0158ekn\u011bme, \u017ee chcete prod\u00e1vat zbo\u017e\u00ed po ur\u010dit\u00e9m po\u010dtu kus\u016f. Po kliknut\u00ed do ko\u0161\u00edku se v\u0161ak p\u0159id\u00e1 jen jeden kus. N\u00e1sleduj\u00edc\u00edm k\u00f3dem po\u010det kus\u016f p\u0159idan\u00fdch do ko\u0161\u00edku uprav\u00edte: V p\u0159\u00edpad\u011b, \u017ee se jedn\u00e1 o produkt<\/p>\n","protected":false},"author":1,"featured_media":5600,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[29],"tags":[],"class_list":["post-6599","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\/6599"}],"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=6599"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6599\/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=6599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}