• Resolved lhabrant

    (@lhabrant)


    Hello,

    On the WooCommerce order page, I’am getting message ‘Error: User status is required!’;
    I searched for where the problem could come from…

    1 – This hook adds extra fields in checkout page:
    add_filter( 'woocommerce_checkout_fields', array( $mangopayWCMain, 'custom_override_checkout_fields' ), 99999 );
    In the method custom_override_checkout_fields, we can see that user_mp_status field is not added if all buyers are either and if user meta exists (that’s my case).

    if('either' == $this->options['default_buyer_status']):
       if(!get_user_meta( get_current_user_id(), 'user_mp_status', true )):
          $fields = $this->add_usermpstatus_field($fields);
       endif;
    endif;

    2 – This hook validates extra fields in the checkout page:
    add_action( 'woocommerce_checkout_process', array( $mangopayWCMain, 'wooc_validate_extra_register_fields_checkout' ));
    The method wooc_validate_extra_register_fields_checkout calls validate_status method.

    3 – The method validate_status displays error on my WooCommerce order page because there is no ‘user_mp_status’ field and no ‘user_id’ field in the checkout form.

    //get the data
    $isset = false;
    $value = false;
    if(isset($data['data_post']['user_mp_status'])): /* THERE IS NO 'user_mp_status' FIELD IN CHECKOUT FORM : $isset = false */
      $value = $data['data_post']['user_mp_status'];
      $isset = true;
    endif;
    
    //in case of edition
    $user_to_test = false;
    if(isset($data['data_post']['user_id'])): /* THERE IS NO 'user_id' FIELD IN CHECKOUT FORM : $user_to_test = false */
    	$user_to_test = get_user_meta( $data['data_post']['user_id'], 'user_mp_status', true );
    endif;
    
    if(!$isset && !$user_to_test): 
      //error
      $data['message'][] = __( 'User status', 'mangopay' );
      $data['message'][] = __( 'is required!', 'mangopay' ); /* DISPLAYS ERROR ON WOOCOMMERCE ORDER PAGE */
      $this->send_message_format($data);
      return;
    endif;

    4 – My solution: adding this code in theme function.php file

    if ( get_user_meta( get_current_user_id(), 'user_mp_status', true ) )
    	add_filter( 'woocommerce_checkout_fields', 'user_mp_status_checkout_field', 99999 );
    
    function user_mp_status_checkout_field( $fields ) {
    	$fields['billing']['user_mp_status'] = array(
    	'type' => 'text',
    	'value' => get_user_meta( get_current_user_id(), 'user_mp_status', true ),
    	'class' => array('hidden'),
      );
      return $fields;
    }

    Can you confirm if that is a bug or a misconfiguration? If this is a bug, will it be corrected to the next update?

    My Mangopay settings:
    All buyers are either
    All vendors are either
    All businesses are either

    My Mangopay status:
    Current environment: Sandbox
    Client ID: Present!
    Passphrase: Present!
    MANGOPAY API Connection: Success!
    MANGOPAY-WooCommerce plugin version: 2.2.1
    Required WooCommerce plugin present & activated: Success!
    WooCommerce plugin version: 3.0.8
    MANGOPAY enabled as a WooCommerce payment gateway: Enabled
    At least one card type or payment method is enabled: Success!
    WooCommerce guest checkout should be disabled Disabled
    Current WooCommerce currency is supported by MANGOPAY: EUR Supported
    Required WC-Vendors plugin present & activated: Success!
    WC-Vendors plugin version: 1.9.11
    PHP mcrypt library available: Success!
    Keyfile directory is writable: Success!
    Temporary directory is writable: Success!
    All active vendors have a MANGOPAY account: Success!

    Other plugins:
    WooCommerce Bookings
    WC Vendors WooCommerce Bookings

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author mangopay

    (@mangopay)

    Hi there, thanks for raising this issue and sorry to hear you’re having troubles. First off, no this is not a known bug. I’d like to know, are you using a completely standard WP user creation form, or is it custom made/personalised in anyway?
    And since we can’t recreate the problem on our side, it would be interesting if you could deactivate all plugins (including the Bookings ones) to see if the problem still exists?

    Plugin Author mangopay

    (@mangopay)

    Hey there, just to let you know that we just released an update which should resovle the “user status is required” bug ??

    Hi there,
    I am using this plugin also and getting the same error on my wp registration page.
    When the user details are added correctly, I get:
    Error: “user status is required”.

    Also is it possible to remove some of the registration fields on the registration page that is provided by mangopay? How would I do that? What file would I have to edit and where?

    Thanks very much.
    Conor

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Error: User status is required!’ is closed to new replies.