2016-09-12 5 views
1

WooCommerceでは、異なる(整数)値を持つ製品ごとにカスタムフィールドdays_manufactureがあります。WooCommerce - Thankyouおよび "My account"ビューオーダーのページのカスタム通知

また、私は「製造日」の最高値で、カートのページにメッセージを表示し、このコードを持っている:

add_action('woocommerce_before_cart', 'days_of_manufacture'); 
function days_of_manufacture() { 
    $day_txt = ' ' . __('day', 'your_theme_domain_slug'); 
    $days_txt = ' ' . __('days', 'your_theme_domain_slug'); 
    $text = __('Your Order will be produced in: ', 'your_theme_domain_slug'); 
    $max_days = 0; 

    foreach(WC()->cart->get_cart() as $cart_item) 
     if($cart_item['days_manufacture'] > $max_days) 
      $max_days = $cart_item['days_manufacture']; 

    if($max_days != 0) { 
     if ($max_days == 1) 
      $days_txt = $day_txt; 

     $output = $text . $max_days . $days_txt; 
     echo "<div class='woocommerce-info'>$output</div>"; 
    } 
} 

を今私はthankyouビューのために、このメッセージを表示したいと思いますページおよびMy account > Orders > View orderページ。

可能ですか?

ありがとうございます!

答えて

関連する問題