• Hi,

    I’m creating a custom solution for a shop using woo commerce. I’m currently working on the checkout page. The aim is to enable users to create a user name (separate from account username), when they enter the name the system would check the database for duplicate entries and report to the user either “username is taken” or “user name is available”.

    The field I have created for this works and the above is an extension. I am working on the basis that we would run the search and report with in the saving of meta process, e.g;

    function jm_save_extra_checkout_fields( $order_id, $posted ){
    	if( isset( $posted['add_to_existing_group'] ) ) {
    
    	        update_post_meta( $order_id, '_add_to_existing_group', sanitize_text_field( $posted['add_to_existing_group'] ) );
    
    	}
    
    add_action( 'woocommerce_checkout_update_order_meta', 'jm_save_extra_checkout_fields', 10, 2 );

    I’ve been studying and working with WordPress for just under a year and can get quite far but right now this is beyond me. I’m currently following tutorials and reading up on $wpdb class and ajax in WP. I’m close to a clear understanding but incorperating this into the above woo commerce checkout field is the next step.

    I’d really appreciate any pointers, guidance or reference to further reading. To learn how to do this is just as important as doing it.

    Thanks

    https://wordpress.org/plugins/woocommerce/

  • The topic ‘checking if meta value exists – custom checkout field’ is closed to new replies.