Skip to content

Instantly share code, notes, and snippets.

View webdados's full-sized avatar

Marco Almeida webdados

View GitHub Profile
@twoelevenjay
twoelevenjay / admin-create-new-customer-on-frontend-checkout.php
Created December 12, 2015 02:16
Allow admins to manually enter new WooCommerce orders from the frontend checkout field.
<?php
// Allow admins to manually enter new WooCommerce orders from the frontend checkout field.
// Hook the woocommerce_checkout_customer_id filter found in the WC_Checkout class.
add_filter( 'woocommerce_checkout_customer_id', 'change_current_user_id_to_new_user' );
function change_current_user_id_to_new_user( $user_id ) {
//Check if logged in user is admin.
if ( current_user_can( 'manage_options' ) ) {