回答編集履歴

1

別の回答

2021/06/08 02:25

投稿

8-0_nyan5
8-0_nyan5

スコア2352

test CHANGED
@@ -29,3 +29,57 @@
29
29
 
30
30
 
31
31
  参考まで。
32
+
33
+
34
+
35
+ 追記
36
+
37
+ ---
38
+
39
+ ```ここに言語を入力
40
+
41
+ function my_mail( $Mail, $values, $Data ){
42
+
43
+ $value = $Data->get( 'カタログ' );
44
+
45
+ $goods_list = array( '製品A', '製品B', '製品C' );
46
+
47
+ foreach ( $goods_list as $goods ) {
48
+
49
+ if ( strpos( $value, $goods ) !== false ) {
50
+
51
+ if( $goods == '製品A' ) {
52
+
53
+ $Mail->body .= '製品A' . "\n" . home_url() . 'item1.html' . "\n" . "\n";
54
+
55
+ }
56
+
57
+ if( $goods == '製品B' ) {
58
+
59
+ $Mail->body .= '製品B' . "\n" . home_url() . 'item2.html' . "\n" . "\n";
60
+
61
+ }
62
+
63
+ if( $goods == '製品C' ) {
64
+
65
+ $Mail->body .= '製品C' . "\n" . home_url() . 'item3.html' . "\n" . "\n";
66
+
67
+ }
68
+
69
+ }
70
+
71
+ }
72
+
73
+ return $Mail;
74
+
75
+ }
76
+
77
+
78
+
79
+ add_filter( 'mwform_auto_mail_mw-wp-form-xxxx', 'my_mail', 10, 3 );
80
+
81
+ ```
82
+
83
+
84
+
85
+ これでもいけるかも?