{"id":2346,"date":"2015-04-09T12:30:35","date_gmt":"2015-04-09T12:30:35","guid":{"rendered":"http:\/\/musilda.cz\/?p=2346"},"modified":"2015-04-09T12:30:35","modified_gmt":"2015-04-09T12:30:35","slug":"minimalni-cena-objednavky-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/minimalni-cena-objednavky-ve-woocommerce\/","title":{"rendered":"Minim\u00e1ln\u00ed cena objedn\u00e1vky ve WooCommerce"},"content":{"rendered":"

Pokud nab\u00edz\u00edte v eshopu specifick\u00e9 zbo\u017e\u00ed a chcete n\u00e1kup podm\u00ednit minim\u00e1ln\u00ed \u010d\u00e1stkou, kterou je pot\u0159eba utratit, aby bylo v\u016fbec mo\u017eno nakoupit, bude se v\u00e1m hodin n\u00e1sleduj\u00edc\u00ed snippet.<\/p>\n

Op\u011bt, stejn\u011b jako v jin\u00fdch p\u0159\u00edpadech, pou\u017eijeme vestav\u011bn\u00e9 akce, kter\u00e9 m\u00e1 WooCommerce v hojn\u00e9m mno\u017estv\u00ed.
Tenotkr\u00e1t to bude woocommerce_checkout_process a woocommerce_before_cart.<\/p>\n

Do functions.php p\u0159id\u00e1me n\u00e1sleduj\u00edc\u00ed k\u00f3d.<\/p>\n

add_action( 'woocommerce_checkout_process', 'wc_minimum_order_amount' );\nadd_action( 'woocommerce_before_cart' , 'wc_minimum_order_amount' );\n\nfunction wc_minimum_order_amount() {\n    $minimum = 50;\n\n    if ( WC()->cart->total < $minimum ) {\n\n        if( is_cart() ) {\n\n            wc_print_notice(\n                sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' ,\n                    wc_price( $minimum ),\n                    wc_price( WC()->cart->total )\n                ), 'error'\n            );\n\n        } else {\n\n            wc_add_notice(\n                sprintf( 'You must have an order with a minimum of %s to place your order, your current order total is %s.' ,\n                    wc_price( $minimum ),\n                    wc_price( WC()->cart->total )\n                ), 'error'\n            );\n\n        }\n    }\n\n}\n<\/pre>\n

Tento k\u00f3d sleduje celkovou hodnotu objedn\u00e1vky, co\u017e znamen\u00e1, \u017ee zapo\u010d\u00edt\u00e1v\u00e1 i cenu dopravy.
Pokud chcete m\u00edt \u010distou hodnotu ko\u0161\u00edku, mus\u00edte zm\u011bnit v\u0161echny z\u00e1pisy WC()->cart->total na WC()->cart->subtotal<\/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":"

Pokud nab\u00edz\u00edte v eshopu specifick\u00e9 zbo\u017e\u00ed a chcete n\u00e1kup podm\u00ednit minim\u00e1ln\u00ed \u010d\u00e1stkou, kterou je pot\u0159eba utratit, aby bylo v\u016fbec mo\u017eno nakoupit, bude se v\u00e1m hodin n\u00e1sleduj\u00edc\u00ed snippet. Op\u011bt, stejn\u011b jako v jin\u00fdch p\u0159\u00edpadech, pou\u017eijeme vestav\u011bn\u00e9 akce, kter\u00e9 m\u00e1 WooCommerce v hojn\u00e9m mno\u017estv\u00ed.Tenotkr\u00e1t to bude woocommerce_checkout_process a woocommerce_before_cart. Do functions.php p\u0159id\u00e1me n\u00e1sleduj\u00edc\u00ed k\u00f3d. add_action( ‚woocommerce_checkout_process‘, ‚wc_minimum_order_amount‘<\/p>\n","protected":false},"author":1,"featured_media":8732,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[19,25,29],"tags":[],"class_list":["post-2346","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-snippety","category-woocommerce","category-woocommerce-snippety"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2346"}],"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=2346"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/2346\/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=2346"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=2346"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=2346"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}