{"id":5598,"date":"2020-05-15T19:38:07","date_gmt":"2020-05-15T19:38:07","guid":{"rendered":"https:\/\/musilda.cz\/?p=5598"},"modified":"2020-05-15T19:38:07","modified_gmt":"2020-05-15T19:38:07","slug":"jak-zmenit-vychozi-razeni-produktu-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-zmenit-vychozi-razeni-produktu-ve-woocommerce\/","title":{"rendered":"Jak zm\u011bnit v\u00fdchoz\u00ed \u0159azen\u00ed produkt\u016f ve WooCommerce"},"content":{"rendered":"\n
WooCommerce m\u00e1 ve v\u00fdchoz\u00edm stavu se\u0159azen\u00e9 produkty podle menu_order. T\u00edmto snippetem to m\u016f\u017eete zm\u011bnit.<\/p>\n\n\n\n
Menu order je \u0159azen\u00ed podle toho, jak jsou produkty se\u0159azen\u00e9 v administraci + je zohledn\u011bn n\u00e1zev. <\/p>\n\n\n\n
V\u00fdchoz\u00ed \u0159azen\u00ed m\u016f\u017eete zm\u011bnit v nastaven\u00e9 produkt\u016f v customiz\u00e9ru, ale z\u00e1rove\u0148 toho m\u016f\u017eete dos\u00e1hnout i pomoc\u00ed jednoduch\u00e9 funkce a filtru. <\/p>\n\n\n\n
Filtr se jmenuje woocommerce_default_catalog_orderby a p\u0159ij\u00edm\u00e1 bu\u010f \u0159et\u011bzec, nebo pole. <\/p>\n\n\n\n
Kdy\u017e vr\u00e1t\u00edte \u0159et\u011bzec, nap\u0159\u00edklad rand, budou se produkty \u0159adit n\u00e1hodn\u011b. V p\u0159\u00edpad\u011b, \u017ee pou\u017eijete pole, prvn\u00ed hodnota bude \u0159azen\u00ed a druh\u00e1 jeho posloupnost. <\/p>\n\n\n\n
Hodnoty, kter\u00e9 m\u016f\u017eete pou\u017e\u00edt jsou:<\/p>\n\n\n\n
Pro zm\u011bnu v\u00fdchoz\u00edho \u0159azen\u00ed pak pou\u017eijete takov\u00fd k\u00f3d:<\/p>\n\n\n\n\n\n\n\n
Tento snippet se n\u00e1m bude hodit a\u017e budeme pot\u0159ebovat vytvo\u0159it vlastn\u00ed v\u00fdchoz\u00ed \u0159azen\u00ed, nap\u0159\u00edklad podle toho, zda jsou produkty skladem a vyp\u00ed\u0161eme je jako prvn\u00ed. <\/p>\n\n\n\n