1
local_pickup
が選択された出荷方法の場合、customer_processing_order
およびcustomer_completed_order
を受け取るべきすべての顧客にメッセージを表示する次のコードを試しました。ローカルピックアップの特定の電子メール通知にカスタムテキストを追加します。
私は、任意の順序メタ内の任意の_shipping_methodアイテムを格納しない気づいたが、唯一の事のように:私はそれを取得するにはどうすればよいlocal_pickup:3
出荷> method_id>:order_item_type?
私は成功せず、コードのこれを試してみました:
// testo per Ritiro in Sede
add_action('woocommerce_email_order_details', 'my_completed_order_email_instructions', 10, 4);
function my_completed_order_email_instructions($order, $sent_to_admin, $plain_text, $email) {
if('customer_processing_order' != $email->id) return;
if (method_exists($order, 'get_id')) {
$order_id = $order->get_id();
} else {
$order_id = $order->id;
}
$shipping_method_arr = get_post_meta($order_id, '_shipping_method', false);
$method_id = explode(':', $shipping_method_arr[0][0]);
$method_id = $method_id[0]; // We get the slug type method
if ('local_pickup' == $method_id){
echo '<p><strong>Ritiro in sede</strong></p>';
}
}
@alemarengo申し訳ありません。私は疲れていました。テスト後に名前を変更して書き留めたとき、私は誤植をしていました...今はうまくいくので、2つのコメントを削除してください。ありがとう、申し訳ありません。 – LoicTheAztec