質問編集履歴
3
補足のコードを追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -78,6 +78,70 @@
|
|
78
78
|
|
79
79
|
という記述があります。
|
80
80
|
|
81
|
+
|
82
|
+
|
83
|
+
また、wc_product1_is_in_the_cart()の定義は以下の通りです。
|
84
|
+
|
85
|
+
```php
|
86
|
+
|
87
|
+
function wc_product1_is_in_the_cart()
|
88
|
+
|
89
|
+
{
|
90
|
+
|
91
|
+
// Add your special product IDs here
|
92
|
+
|
93
|
+
$ids = array(
|
94
|
+
|
95
|
+
'6231',
|
96
|
+
|
97
|
+
'6277',
|
98
|
+
|
99
|
+
'6233',
|
100
|
+
|
101
|
+
'6278',
|
102
|
+
|
103
|
+
'6234',
|
104
|
+
|
105
|
+
);;
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
// Products currently in the cart
|
110
|
+
|
111
|
+
$cart_ids = array();
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
// Find each product in the cart and add it to the $cart_ids array
|
116
|
+
|
117
|
+
foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
|
118
|
+
|
119
|
+
$cart_product = $values['data'];
|
120
|
+
|
121
|
+
$cart_ids[] = $cart_product->get_id();
|
122
|
+
|
123
|
+
}
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
// If one of the special products are in the cart, return true.
|
128
|
+
|
129
|
+
if (!empty(array_intersect($ids, $cart_ids))) {
|
130
|
+
|
131
|
+
return true;
|
132
|
+
|
133
|
+
} else {
|
134
|
+
|
135
|
+
return false;
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
```
|
142
|
+
|
143
|
+
|
144
|
+
|
81
145
|
他に必要な情報がありましたら、追加で記述いたします。
|
82
146
|
|
83
147
|
どなたかお力を貸していただければ幸いです。
|
2
内容の訂正
test
CHANGED
File without changes
|
test
CHANGED
@@ -46,7 +46,7 @@
|
|
46
46
|
|
47
47
|
```
|
48
48
|
|
49
|
-
動作確認のため、Product2を注文・確定すると、確認メールには「
|
49
|
+
動作確認のため、Product2を注文・確定すると、確認メールには「Non refundable.」と表示されてしまいます。
|
50
50
|
|
51
51
|
|
52
52
|
|
1
タグの追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|