{"id":6241,"date":"2021-10-01T08:48:08","date_gmt":"2021-10-01T08:48:08","guid":{"rendered":"https:\/\/musilda.cz\/?p=6241"},"modified":"2021-10-01T08:48:08","modified_gmt":"2021-10-01T08:48:08","slug":"jak-zobrazit-tridu-dopravy-v-kosiku","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zobrazit-tridu-dopravy-v-kosiku\/","title":{"rendered":"Jak zobrazit t\u0159\u00eddu dopravy v ko\u0161\u00edku"},"content":{"rendered":"\n

T\u0159\u00eddy dopravy jsou velice mocn\u00fd n\u00e1stroj, pokud s n\u00edm dok\u00e1\u017eete spr\u00e1vn\u011b pracovat. M\u016f\u017eete je vyu\u017e\u00edt pro \u00fapravu ceny dopravy u speci\u00e1ln\u00edho zbo\u017e\u00ed, nebo je vyu\u017e\u00edt jako nositele dopl\u0148uj\u00edc\u00edch informac\u00ed. <\/p>\n\n\n\n

Tento snippet v\u00e1m umo\u017en\u00ed zobrazit v ko\u0161\u00edku n\u00e1zev dopravn\u00ed t\u0159\u00eddy, co\u017e jsem v tomto p\u0159\u00edpad\u011b vyu\u017eil k p\u0159id\u00e1n\u00ed textu „k\u0159ehk\u00e9“ k polo\u017ece v ko\u0161\u00edku<\/p>\n\n\n\n

\"\"<\/a><\/figure>\n\n\n\n

Pro zobrazen\u00ed pou\u017eijte n\u00e1sleduj\u00edc\u00ed snippet:<\/p>\n\n\n\n

add_filter( 'woocommerce_cart_item_name', 'shipping_class_in_item_name', 20, 3 );\nfunction shipping_class_in_item_name( $item_name, $cart_item, $cart_item_key ) {\n\n\tif( ! ( is_cart() || is_checkout() ) ) {\n\t\treturn $item_name;\n\t}\n\n    $product = $cart_item['data'];\n    $shipping_class_id = $product->get_shipping_class_id();\n\n    if( empty( $shipping_class_id ) ) {\n        return $item_name;\n\t}\n\n\t$shipping_class_term = get_term( $shipping_class_id, 'product_shipping_class' );\n\n    $output = '<br><span class=\"item-shipping_class\" style=\"font-size:12px;font-weight:normal;\">' . $shipping_class_term->name . '<\/span>';\n\n    return $item_name . $output;\n\n}<\/code><\/pre>\n\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":"

T\u0159\u00eddy dopravy jsou velice mocn\u00fd n\u00e1stroj, pokud s n\u00edm dok\u00e1\u017eete spr\u00e1vn\u011b pracovat. M\u016f\u017eete je vyu\u017e\u00edt pro \u00fapravu ceny dopravy u speci\u00e1ln\u00edho zbo\u017e\u00ed, nebo je vyu\u017e\u00edt jako nositele dopl\u0148uj\u00edc\u00edch informac\u00ed. Tento snippet v\u00e1m umo\u017en\u00ed zobrazit v ko\u0161\u00edku n\u00e1zev dopravn\u00ed t\u0159\u00eddy, co\u017e jsem v tomto p\u0159\u00edpad\u011b vyu\u017eil k p\u0159id\u00e1n\u00ed textu „k\u0159ehk\u00e9“ k polo\u017ece v ko\u0161\u00edku Pro zobrazen\u00ed<\/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-6241","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\/6241"}],"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=6241"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6241\/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=6241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}