{"id":6998,"date":"2023-11-17T07:45:27","date_gmt":"2023-11-17T07:45:27","guid":{"rendered":"https:\/\/musilda.cz\/?p=6998"},"modified":"2023-11-17T07:45:27","modified_gmt":"2023-11-17T07:45:27","slug":"woocommerce-8-3-automaticky-nastavuje-gutenberg-bloky-pro-kosik-pokladnu-a-dekovnou-stranku","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/woocommerce-8-3-automaticky-nastavuje-gutenberg-bloky-pro-kosik-pokladnu-a-dekovnou-stranku\/","title":{"rendered":"WooCommerce 8.3 automaticky nastavuje Gutenberg bloky pro ko\u0161\u00edk, pokladnu a d\u011bkovnou str\u00e1nku"},"content":{"rendered":"\n

WooCommerce v nov\u00e9 verzi, vydan\u00e9 16.11.2023, zav\u00e1d\u00ed pro nov\u00e9 instalace e-shop, jako defaultn\u00ed bloky pro ko\u0161\u00edk, pokladnu a d\u011bkovnou str\u00e1nku. <\/p>\n\n\n\n

Verze 8.3 WooCommerce byla trochu opo\u017ed\u011bna, jeliko\u017e hlavn\u00ed v\u00fdvoj\u00e1\u0159i se zam\u011b\u0159ili na zaji\u0161t\u011bn\u00ed kompatibility s nejnov\u011bj\u0161\u00edmi aktualizacemi WordPressu 6.4 a tak\u00e9 s p\u0159ipravovanou verz\u00ed PHP 8.3, kter\u00e1 m\u00e1 vyj\u00edt 23. listopadu 2023. C\u00edlem bylo tak\u00e9 d\u00e1t dostatek \u010dasu v\u00fdvoj\u00e1\u0159\u016fm plugin\u016f, aby se p\u0159izp\u016fsobili nov\u00e9mu standardu, kde jsou bloky pro ko\u0161\u00edk a pokladnu nastaveny jako v\u00fdchoz\u00ed. Dokument s nej\u010dast\u011bj\u0161\u00edmi ot\u00e1zkami<\/a> poskytuje instrukce pro v\u00fdvoj\u00e1\u0159e, kte\u0159\u00ed pot\u0159ebuj\u00ed upravit sv\u00e9 dopl\u0148ky pro zachov\u00e1n\u00ed kompatibility.<\/p>\n\n\n\n

V\u00fdvoj\u00e1\u0159i, jejich\u017e pluginy nejsou kompatibiln\u00ed s nov\u00fdm blokov\u00fdm syst\u00e9mem pokladny, by m\u011bli sv\u00e9 produkty ozna\u010dit jako nekompatibiln\u00ed. D\u00edky tomu WooCommerce m\u016f\u017ee informovat u\u017eivatele prost\u0159ednictv\u00edm upozorn\u011bn\u00ed v nastaven\u00ed. Pro pluginy, kter\u00e9 neovliv\u0148uj\u00ed ko\u0161\u00edk a pokladnu, nejsou pot\u0159eba \u017e\u00e1dn\u00e9 zm\u011bny.<\/p>\n\n\n\n

Tato zm\u011bna se nedotkne st\u00e1vaj\u00edc\u00edch instalac\u00ed, pokud nesma\u017eete shortcody, kter\u00e9 jsou um\u00edst\u011bn\u00e9 ve str\u00e1nce ko\u0161\u00edku a pokladny. <\/p>\n\n\n\n

Jestli\u017ee chcete vyzkou\u0161et novou funkci, sta\u010d\u00ed je odstranit a nedefinovat si str\u00e1nku pokladny v editoru.<\/p>\n\n\n\n

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

Probl\u00e9m nast\u00e1v\u00e1 u plugin\u016f, kter\u00e9 n\u011bjak\u00fdm zp\u016fsobem zasahuj\u00ed do funkce ko\u0161\u00edku a pokladny. Bu\u010f budou deklarov\u00e1ny jako kompatibiln\u00ed, nebo nebudou fungovat. <\/p>\n\n\n\n

Tak\u017ee se m\u016f\u017ee st\u00e1t, \u017ee pluginy, na kter\u00e9 jste byli zvykl\u00ed, p\u0159estanou plnit svou funkci. <\/p>\n\n\n\n

Pro deklaraci kompatibility mus\u00ed m\u00edt plugin v hlavi\u010dce uveden z\u00e1pis:<\/p>\n\n\n\n

WC tested up to: 8.0<\/code><\/pre>\n\n\n\n

N\u00e1sledn\u011b pak mus\u00ed b\u00fdt pro pluginy nekompatibiln\u00ed v k\u00f3du funkce:<\/p>\n\n\n\n

add_action( 'before_woocommerce_init', function() {\n\n    if ( class_exists( '\\Automattic\\WooCommerce\\Utilities\\FeaturesUtil' ) ) {\n\n        \\Automattic\\WooCommerce\\Utilities\\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', __FILE__, false );\n\n    }\n\n} );<\/code><\/pre>\n\n\n\n

Analogicky pro kompatibiln\u00ed pluginy se zm\u011bn\u00ed false na true.<\/p>\n\n\n\n

Co \u010dekat od nov\u00e9 feature?<\/h2>\n\n\n\n

M\u00e1m z n\u00ed pon\u011bkud sm\u00ed\u0161en\u00e9 pocity. Gutenberg block je uzav\u0159en\u00e1 \u010d\u00e1st k\u00f3du, do kter\u00e9ho se d\u00e1 velmi t\u011b\u017eko zasahovat. U jednoho nov\u00e9ho e-shopu jsem musel napsat vlastn\u00ed side cart, proto\u017ee do v\u00fdchoz\u00edho, kter\u00fd je ve Woo, ne\u0161ly doplnit \u017e\u00e1dn\u00e9 v\u011bci nav\u00edc, nap\u0159\u00edklad informace o doprav\u011b zdarma.<\/p>\n\n\n\n

Sice z\u016fst\u00e1vaj\u00ed funk\u010dn\u00ed hooky, ale ji\u017e neovlivn\u00edte html k\u00f3d blok\u016f. V p\u016fvodn\u00ed verzi to bylo snadn\u00e9, vzali jste soubor, kter\u00fd jste cht\u011bli upravit a p\u0159ed\u011blali jste ho k obrazu sv\u00e9mu (nebo UX\u00e1kov\u011b obrazu). Z jednoduch\u00e9 pokladny se pak dal ud\u011blat v\u00edce korkov\u00fd proces, jako nap\u0159\u00edklad na tomto e-shopu<\/a>.<\/p>\n\n\n\n

Nav\u00edc, ne v\u0161echny hooky z\u016fstanou, zde je seznam<\/a>.<\/p>\n\n\n\n

Budete muset v\u00edce testovat pluginy dostupn\u00e9 na trhu a u nov\u00fdch e-shop\u016f nemus\u00ed fungovat star\u0161\u00ed n\u00e1vody a k\u00f3d. <\/p>\n\n\n\n

Moc z t\u00e9to zm\u011bny nad\u0161en\u00fd nejsem a u nov\u00fdch instalac\u00ed budu tuto novinku vyp\u00ednat. <\/p>\n","protected":false},"excerpt":{"rendered":"

WooCommerce v nov\u00e9 verzi, vydan\u00e9 16.11.2023, zav\u00e1d\u00ed pro nov\u00e9 instalace e-shop, jako defaultn\u00ed bloky pro ko\u0161\u00edk, pokladnu a d\u011bkovnou str\u00e1nku. Verze 8.3 WooCommerce byla trochu opo\u017ed\u011bna, jeliko\u017e hlavn\u00ed v\u00fdvoj\u00e1\u0159i se zam\u011b\u0159ili na zaji\u0161t\u011bn\u00ed kompatibility s nejnov\u011bj\u0161\u00edmi aktualizacemi WordPressu 6.4 a tak\u00e9 s p\u0159ipravovanou verz\u00ed PHP 8.3, kter\u00e1 m\u00e1 vyj\u00edt 23. listopadu 2023. C\u00edlem bylo tak\u00e9<\/p>\n","protected":false},"author":1,"featured_media":7000,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[25],"tags":[],"class_list":["post-6998","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-woocommerce"],"_links":{"self":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6998"}],"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=6998"}],"version-history":[{"count":0,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/posts\/6998\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media\/7000"}],"wp:attachment":[{"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/media?parent=6998"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/categories?post=6998"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/affinite.io\/cs\/wp-json\/wp\/v2\/tags?post=6998"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}