2016-09-12 5 views
1

WooCommerce에서 다른 (정수) 값을 가진 각 제품에 대해 사용자 정의 필드 days_manufacture이 있습니다. 또한WooCommerce - Thankyou 및 "내 계정"보기 주문 페이지의 사용자 정의 알림

내가"제조의 일"의 가장 높은 값 카트 페이지에 메시지를 표시이 코드를 가지고 :

이제
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 페이지.

가능합니까?

감사합니다!

답변