Bestellungen auf Rechnung bleiben normal immer auf “on hold” hängen. Damit diese automatisch “Processing” erhalten, muss folgender Code im Childtheme oder Plugin platziert werden:

add_action( 'woocommerce_thankyou', 'woocommerce_auto_processing_orders');
function woocommerce_auto_processing_orders( $order_id ) {
	if(!$order_id) return;
	$order = wc_get_order( $order_id );
	if($order->has_status('on-hold')) { $order->update_status( 'processing' ); }
}

Dieser Code setzt alle Bestellungen automatisch auf processing. Wenn man will, kann man auch prüfen ob die Bestellung per “bacs” gemacht wurde (Rechnung).

Es wird das Trusted Shop Template von Germanized missverwendet.

add_filter( 'woocommerce_order_data_store_cpt_get_orders_query', 'handle_custom_query_var', 10, 2 );
function handle_custom_query_var( $query, $query_vars ) {
	if ($query_vars['remindersend'] == '0') {
		$query['meta_query'][] = array(
			'key' => '_reminder_email_sent',
			'compare' => 'NOT EXISTS'
		);
	}
	return $query;
}

if (!wp_next_scheduled( 'reminder_cron_hook' ) ) {
	wp_schedule_event( strtotime('09:30:00'), 'daily', 'reminder_cron_hook' );
}

add_action( 'reminder_cron_hook', 'reminder_cron_function' );
function reminder_cron_function() {
	$remindernachtagen = 14;
	$bis = time() - ($remindernachtagen * 86400);
	$von = $bis - (14 * 86400);

	$args = array(
		'status' => 'wc-completed',
		'date_completed' => date("Y-m-d",$von).'...'.date("Y-m-d",$bis),
		'return' => 'ids',
		'remindersend' => '0'
	);
	$orders = wc_get_orders( $args );

	$allmails = WC()->mailer()->emails;
	$email = $allmails['WC_TS_Email_Customer_Trusted_Shops'];
	foreach ($orders as $order_id) {
		$email->trigger( $order_id );
		$order = wc_get_order( $order_id );
		$order->update_meta_data( '_reminder_email_sent', '1' );
		$order->save();
	}
}

Wenn mehrere Versandmöglichkeiten möglich sind, aber kostenloser Versand verfügbar ist, wird alles entfernt und automatisch kostenlos verschickt:

add_filter( 'woocommerce_package_rates', 'wuk_hide_shipping_when_free_is_available', 100 );
function wuk_hide_shipping_when_free_is_available( $rates ) {
	$free = array();
	foreach ( $rates as $rate_id => $rate ) {
		if ( 'free_shipping' === $rate->method_id ) {
			$free[ $rate_id ] = $rate;
			break;
		}
	}
	return ! empty( $free ) ? $free : $rates;
}

Wenn keineHausnummer bei der Adresszeile eingegeben wird,wird eine einmalige Warnung ausgegeben um dies zu korrigieren.

add_action('woocommerce_checkout_process', 'address_field_validation', 10, 0);
function address_field_validation() {
	if ($_POST['billing_address_1'] && ! preg_match( '/[0-9]+/', $_POST['billing_address_1'] ) && (!isset($_SESSION['oncehausnummer']) OR $_SESSION['oncehausnummer'] <= (time()-120))) {
		$_SESSION['oncehausnummer'] = time();
		throw new Exception( sprintf( __( 'Bei der Strasse wurde keine Hausnummer gefunden. Bitte geben Sie diese an, falls Sie eine besitzen. Besitzen Sie keine, können Sie einfach nochmals zu Schritt 2 weitergehen.', 'woocommerce' ) ) );
	}
}

Entfernt Kanton und 2te Adresszeile:

add_filter( 'woocommerce_default_address_fields' , 'wuk_remove_checkout_fields2' );
function wuk_remove_checkout_fields2( $fields ) {
	unset($fields['address_2']);
	unset($fields['state']);
	$fields['postcode']['class'] = array('address-field','form-row-first');
	$fields['city']['class'] = array('address-field','form-row-last');
	return $fields;
}
add_filter( 'woocommerce_checkout_fields' , 'wuk_remove_checkout_fields' );
function wuk_remove_checkout_fields( $fields ) {
	unset($fields['billing']['billing_address_2']);
	unset($fields['billing']['billing_state']);
	unset($fields['shipping']['shipping_address_2']);
	unset($fields['shipping']['shipping_state']);
	$fields['billing']['billing_postcode']['class'] = array('form-row-first');
	$fields['billing']['billing_city']['class']= array('form-row-last');
	$fields['shipping']['shipping_postcode']['class'] = array('form-row-first');
	$fields['shipping']['shipping_city']['class']= array('form-row-last');
	return $fields;
}