• Resolved christopherstamper

    (@christopherstamper)


    I have a custom user field defined in WordPress, (Boolean)Authorized. I defined this field using another plugin (MemberPress) and it’s accessible using the slug mepr_authorized.

    I would like to check this field in the WooCommerce checkout process. If it’s FALSE/0, then the user should not be able to complete the checkout process – and instead be presented with UI indicating as such. The field itself should not be displayed in an editable fashion.

    Any ideas how I can do this?

    One thought I had was a custom, non-editable but required field in WooCommerce, that I would automatically set via PHP (basically retrieve the user value and assign it). Is this feasible?

    Any feedback is awesome. Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter christopherstamper

    (@christopherstamper)

    for the record, this did the trick (top of form-checkout.php)

    //	If the user is not authorized, they cannot checkout
    if ((get_user_meta(get_current_user_id(), 'mepr_authorized', 1))!= TRUE)
    {
    	echo apply_filters( 'woocommerce_checkout_must_be_logged_in_message', __( 'You must be authorized in order to checkout! Please make sure you have uploaded the required logo file, and then give us 3-6 days to process the request and authorize your account.', 'woocommerce' ) );
    	return;
    }
Viewing 1 replies (of 1 total)
  • The topic ‘WooCommerce: Checking a wp-user field before allowing checkou’ is closed to new replies.