{"id":6560,"date":"2022-01-03T10:02:00","date_gmt":"2022-01-03T10:02:00","guid":{"rendered":"https:\/\/musilda.cz\/?p=6560"},"modified":"2022-01-03T10:02:00","modified_gmt":"2022-01-03T10:02:00","slug":"pridani-obsahu-do-specifickeho-e-mailu","status":"publish","type":"post","link":"https:\/\/affinite.io\/cs\/pridani-obsahu-do-specifickeho-e-mailu\/","title":{"rendered":"P\u0159id\u00e1n\u00ed obsahu do specifick\u00e9ho e-mailu"},"content":{"rendered":"\n
P\u0159esto\u017ee je mo\u017en\u00e9 pom\u011brn\u011b jednodu\u0161e upravovat \u0161ablonu e-mailu, b\u00fdv\u00e1 n\u011bkdy pot\u0159eba p\u0159idat obsah do konkr\u00e9tn\u00edho e-mailu. <\/p>\n\n\n\n
P\u0159edstavte si, \u017ee pot\u0159ebujete do e-mailu p\u0159idat kup\u00f3n na slevu pro p\u0159\u00ed\u0161t\u00ed n\u00e1kup. B\u011b\u017en\u00fd postup je p\u0159idat do \u0161ablony e-mailu k\u00f3d, kter\u00fd v\u00e1m nab\u00eddku zobraz\u00ed. <\/p>\n\n\n\n
Kdy\u017e to sam\u00e9 budete cht\u00edt ud\u011blat na dal\u0161\u00edm e-shopu, budete muset znovu upravit soubor e-mailu. <\/p>\n\n\n\n
Proto je elegantn\u011bj\u0161\u00ed \u0159e\u0161en\u00ed, vyu\u017e\u00edt akci a pomoc\u00ed id e-mailu detekovat, o jak\u00e1 e-mail se jedn\u00e1. <\/p>\n\n\n\n
Na screenu vid\u00edte hlavi\u010dku tabulky se souhrnem objedn\u00e1vky a tam pomoc\u00ed k\u00f3du p\u0159id\u00e1me \u0159\u00e1dek s informac\u00ed o kup\u00f3nu. <\/p>\n\n\n\n
Je\u0161t\u011b mus\u00edme definovat do kter\u00e9ho e-mailu se bude text vypisovat.<\/p>\n\n\n\n
Ka\u017ed\u00fd e-mail m\u00e1 sv\u00e9 id a pomoc\u00ed n\u011bj jej m\u016f\u017eete identifikovat. Jsou to:<\/p>\n\n\n\n
Pro zobrazen\u00ed obsahu pou\u017eijeme n\u00e1sleduj\u00edc\u00ed k\u00f3d:<\/p>\n\n\n\n
add_action( 'woocommerce_email_order_details', 'musilda_completed_order_coupon', 5, 4 );\nfunction musilda_completed_order_coupon( $order, $sent_to_admin, $plain_text, $email ) {\n\n\tif ( 'customer_completed_order' === $email->id ) {\n\n\t\techo '<h2>Sleva na p\u0159\u00ed\u0161t\u00ed n\u00e1kup!<\/h2>';\n\t\techo '<p>D\u011bkujeme za v\u00e1\u0161 n\u00e1kup a jako pod\u011bkov\u00e1n\u00ed jsme pro v\u00e1s p\u0159ipravili slevu na dal\u0161\u00ed n\u00e1kup ve v\u00fd\u0161i 10%. P\u0159i dal\u0161\u00edm n\u00e1kupu pou\u017eijte v pokladn\u011b k\u00f3d <strong>SLEVANAKUP<\/strong><\/p>';\n\n\t}\n\n}<\/code><\/pre>\n\n\n\nJako id e-mailu jsme pou\u017eili customer completed order, proto\u017ee vygenerov\u00e1n\u00ed kup\u00f3nu na dal\u0161\u00ed n\u00e1kup m\u00e1 smysl, a\u017e kdy\u017e je objedn\u00e1vka dokon\u010dena.<\/p>\n\n\n\n