add_action( 'woocommerce_before_email_order', 'add_order_instruction_email', 10, 2 );
function add_order_instruction_email( $order, $sent_to_admin ) {
if ( ! $sent_to_admin ) {
if ( 'cod' == $order->payment_method ) {
// cash on delivery method
echo '<p><strong>Instructions:</strong> Full payment is due immediately upon delivery: <em>cash only, no exceptions</em>.</p>';
} else {
// other methods (ie credit card)
echo '<p><strong>Instructions:</strong> Please look for "Madrigal Electromotive GmbH" on your next credit card statement.</p>';
}
}
}
Premium
Order date-time in customer processing order email notification
//Order date-time in customer processing order email notification
add_action( 'woocommerce_email_order_details', 'custom_processing_order_notification', 1, 4 );
function custom_processing_order_notification( $order, $sent_to_admin, $plain_text, $email ) {
// Only for processing email notifications to customer
if( ! 'customer_processing_order' == $email->id ) return;
$date_modified = $order->get_date_modified();
$date_paid = $order->get_date_paid();
$date = empty( $date_paid ) ? $date_modified : $date_paid;
echo sprintf( '<p>A rendelés száma: %s <br>A rendelés dátuma: <time>%s</time>)</p>',
$order->get_order_number( ),
$date->date("Y.m.j.")
);
}
Disable Payment Method for Specific Category
add_filter('woocommerce_available_payment_gateways','bbloomer_unset_gateway_by_category');
function bbloomer_unset_gateway_by_category($available_gateways){
global $woocommerce;
$category_IDs = array(38,39);
foreach ($woocommerce->cart->cart_contents as $key => $values ) {
$terms = get_the_terms( $values['product_id'], 'product_cat' );
foreach ($terms as $term) {
if(in_array($term->term_id, $category_IDs)){
unset( $available_gateways['cod'] );
break;
}
break;
}
}
return $available_gateways;
}