{"id":6549,"date":"2022-01-01T10:33:00","date_gmt":"2022-01-01T10:33:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6549"},"modified":"2022-01-01T10:33:00","modified_gmt":"2022-01-01T10:33:00","slug":"jak-pridat-vlastni-placeholder-do-e-mailu-woocommerce","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/jak-pridat-vlastni-placeholder-do-e-mailu-woocommerce\/","title":{"rendered":"Jak p\u0159idat vlastn\u00ed placeholder do e-mailu WooCommerce"},"content":{"rendered":"\n
E-maily WooComerce v z\u00e1kladu obsahuj\u00ed n\u011bkolik placeholder\u016f, kter\u00e9 se daj\u00ed pou\u017e\u00edt v textech e-mailu a umo\u017e\u0148uj\u00ed p\u0159idat informaci z ulo\u017een\u00fdch dat. <\/p>\n\n\n\n
Ve snippetu https:\/\/musilda.cz\/pridani-jmena-do-predmetu-e-mailu-woocommerce\/<\/a>, jsme p\u0159edm\u011bt e-mailu zm\u011bnili a p\u0159idali do n\u011bj osloven\u00ed. <\/p>\n\n\n\n Tento postup bohu\u017eel neumo\u017e\u0148uje upravit text p\u0159edm\u011btu jinak, ne\u017e \u00fapravou k\u00f3du. <\/p>\n\n\n\n A proto\u017ee my chceme m\u00edt mo\u017enost p\u0159epsat v nastaven\u00ed, pou\u017eijeme n\u00e1sleduj\u00edc\u00ed k\u00f3d:<\/p>\n\n\n\n D\u00edky t\u00e9to funkci m\u016f\u017eeme v e-mailu pou\u017e\u00edt vlastn\u00ed placeholder:<\/p>\n\n\n\n<\/a><\/figure>\n\n\n\n
add_filter( 'woocommerce_email_format_string', 'musilda_custom_email_placeholder', 10, 2 );\nfunction musilda_custom_email_placeholder( $text, $email ) {\n\n\treturn str_replace( '{first_name}', $email->object->get_billing_first_name(), $text );\n\n}<\/code><\/pre>\n\n\n\n
<\/a><\/figure>\n\n\n\n