Add order complete action to WooCommerce My Orders customer table

if ( ! function_exists( 'wcj_add_my_account_order_actions' ) ) {
	/*
	 * wcj_add_my_account_order_actions.
	 */
	function wcj_add_my_account_order_actions( $actions, $order ) {
		if ( 'completed' != $order->get_status() ) {
			$actions['wcj_mark_completed_by_customer'] = array(
				'url'  => wp_nonce_url( add_query_arg( array(
					'wcj_action' => 'wcj_woocommerce_mark_order_status',
					'order_id'   => $order->get_id() ) ), 'wcj-woocommerce-mark-order-status' ),
				'name' => __( 'Complete', 'woocommerce-jetpack' ),
			);
		}
		return $actions;
	}
}
add_filter( 'woocommerce_my_account_my_orders_actions', 'wcj_add_my_account_order_actions', 10, 2 );
if ( ! function_exists( 'wcj_add_js_conformation' ) ) {
	/*
	 * wcj_add_js_conformation.
	 */
	function wcj_add_js_conformation() {
		echo '<script>
			jQuery("a.wcj_mark_completed_by_customer").each( function() { jQuery(this).attr("onclick", "return confirm(\'' . __( 'Are you sure?', 'woocommerce-jetpack' ) . '\')") } );
		</script>';
	}
}
add_action( 'wp_footer', 'wcj_add_js_conformation' );
if ( ! function_exists( 'wcj_woocommerce_mark_order_status' ) ) {
	/*
	 * wcj_woocommerce_mark_order_status.
	 */
	function wcj_woocommerce_mark_order_status() {
		if ( isset( $_GET['wcj_action'] ) && 'wcj_woocommerce_mark_order_status' === $_GET['wcj_action'] && isset( $_GET['order_id'] ) && isset( $_GET['_wpnonce'] ) ) {
			if ( wp_verify_nonce( $_GET['_wpnonce'], 'wcj-woocommerce-mark-order-status' ) ) {
				$_order = wc_get_order( $_GET['order_id'] );
				if ( $_order->get_customer_id() === get_current_user_id() ) {
					$_order->update_status( 'completed' );
					wp_safe_redirect( remove_query_arg( array( 'wcj_action', 'order_id', '_wpnonce' ) ) );
					exit;
				}
			}
		}
	}
}
add_action( 'init', 'wcj_woocommerce_mark_order_status' );

Checkout Field ZIP code validation

add_action('woocommerce_checkout_process', 'my_custom_checkout_field_process');

function my_custom_checkout_field_process() {
	global $woocommerce;

	// Check if set, if its not set add an error. This one is only requite for companies
	if ( ! (preg_match('/^[0-9]{4}$/D', $_POST['billing_postcode'] ))){
		wc_add_notice( "The Postcode should contain only 4 digits"  ,'error' );
	}
	
	if( ! (preg_match("/^[a-zA-Z]+$/", $_POST['billing_first_name']))){
		wc_add_notice( "The Billing First Name should contain only alphanumeric characters [a-z] and [A-Z]"  ,'error' );
	}
	
	if( ! (preg_match("/^[a-zA-Z]+$/", $_POST['billing_last_name']))){
		wc_add_notice( "The Billing Last Name should contain only alphanumeric characters [a-z] and [A-Z]"  ,'error' );
	}
	
	if( ! (preg_match("/^[a-zA-Z]+$/", $_POST['billing_city']))){
		wc_add_notice( "The City should contain only alphanumeric characters [a-z] and [A-Z]"  ,'error' );
	}
	
}

Check if user agent is bot in PHP

if ( ! function_exists( 'is_bot' ) ) {
	/**
	 * is_bot.
	 */
	function is_bot() {
		$bots = array(
			'Google-Structured-Data-Testing-Tool',
			'bot',
			'crawl',
			'slurp',
			'spider',
		);
		$bots = '/' . implode( '|', $bots ). '/i';
		// For faster execution instead of array and implode use:
		// $bots = '/Google-Structured-Data-Testing-Tool|bot|crawl|slurp|spider/i';
		return ( isset( $_SERVER['HTTP_USER_AGENT'] ) && preg_match( $bots, $_SERVER['HTTP_USER_AGENT'] ) );
	}
}