• Skip to main content
  • Skip to primary sidebar

WordPress, Genesis Framework and Storefront customization tutorials

  • Archive
    • Free
    • Premium
  • Blog
  • About
  • Contact
  • Newsletter
  • Login
Home » Premium » Page 3

Premium

Add instructions to the email, based on the payment method

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>';
 }
 }
}

Filed Under: Premium Tagged With: WooCommerce

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.")
);
}

Filed Under: Premium Tagged With: WooCommerce

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;
}

Filed Under: Premium Tagged With: WooCommerce

  • « Go to Previous Page
  • Page 1
  • Page 2
  • Page 3

Primary Sidebar

Gabor Flamich

Hi! I'm Gabor.
I write tutorials on WordPress and WooCommerce.

MacBook

12 Essential Snippets for Genesis Developers

Subscribe to my Newsletter to view my basic collection of Genesis snippets that I use for my projects!

Sign Up for Free
  • Facebook
  • GitHub
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube
UpdraftPlus Premium

Tags

ACF Ajax Analytics API Bootstrap Breadcrumb category CPT CSS fetch FSE Genesis Google Maps Gutenberg HTML Isotope JavaScript jQuery loop Map Menu Parallax PHP Rest API SASS SEO SQL Storefront SVG tab tag manager tags Taxonomy Tool upsell Webpack Wholesale WooCommerce WordPress WPML

Disclosure: Some of the links in this site are affiliate links. I will be paid a commission if you use this link to make a purchase.

  • Privacy Policy / Terms of Service
© 2025 WP Flames - All Right Reserved