{"id":2307,"date":"2015-01-11T06:49:23","date_gmt":"2015-01-11T06:49:23","guid":{"rendered":"http:\/\/musilda.cz\/?p=2307"},"modified":"2015-01-11T06:49:23","modified_gmt":"2015-01-11T06:49:23","slug":"zobrazeni-ceny-pouze-pro-prihlasene-uzivatele-ve-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/zobrazeni-ceny-pouze-pro-prihlasene-uzivatele-ve-woocommerce\/","title":{"rendered":"Zobrazen\u00ed ceny pouze pro p\u0159ihl\u00e1\u0161en\u00e9 u\u017eivatele ve WooCommerce"},"content":{"rendered":"\n
P\u016fvodn\u011b jsem cht\u011bl tento snippet vlo\u017eit jako odpov\u011b\u010f do jednoho koment\u00e1\u0159e, ale to se mi nepovedlo korektn\u011b. Proto dnes jednoduch\u00e1 funkce, kter\u00e1 obraz\u00ed pro nep\u0159ihl\u00e1\u0161en\u00e9 u\u017eivatele textovou informaci.<\/p>\n\n\n\n\n\n\n\n
Snippet vyu\u017e\u00edv\u00e1 woocommerce_get_html_price, kter\u00fd se d\u00e1 vyu\u017e\u00edt k zaj\u00edmav\u00fdm v\u011bcem, jako je nap\u0159\u00edklad zobrazen\u00ed ceny pouze pro p\u0159ihl\u00e1\u0161en\u00e9 u\u017eivatele. V\u00fdborn\u00e9, pokud vytv\u00e1\u0159\u00edte klubov\u00fd eshop.<\/p>\n\n\n\n
Sta\u010d\u00ed pou\u017e\u00edt tuto funkci:<\/p>\n\n\n\n
add_filter('woocommerce_get_price_html','members_only_price');\n function members_only_price($price){\n if(is_user_logged_in() ){\n return $price;\n }\n else{\n return 'Login<\/a> or Register<\/a> to see price!';\n }\n}\n<\/pre>\n\n\n\n