• Resolved Torchy

    (@torkild)


    I have disabled guest login /ordering in WooCommerce but it still allows me to enter an order using a guest customer.
    Is it possible to force this field, make it required to either enter a new customer or select an existing customer before allowing a new order to be placed?

    Torkild

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author algol.plus

    (@algolplus)

    Hello Torkild

    we don’t have necessary hook/filter.

    so please, submit ticket to https://algolplus.freshdesk.com/
    and we’ll provide modified version and some PHP code.

    thanks, Alex

    Thread Starter Torchy

    (@torkild)

    Hi Alex,

    Thanks for the quick response.
    A support ticket is submitted.

    KR
    Torkild

    Plugin Author algol.plus

    (@algolplus)

    I’m sorry, I was wrong .
    please, try this code

    add_filter("wpo_before_ajax_create_order", function($request ){
    if( empty($request["cart"]["customer"]["id"]) ) {
    	echo json_encode( array(
    			'success' => false,
    			'data' => "You should create/select customer",
    		));
    	die();
    }
    });
    Thread Starter Torchy

    (@torkild)

    Thanks, Alex,
    Works a treat!

    Thanks for the super speedy support!

    5stars given

    KR
    Torkild

    Plugin Author algol.plus

    (@algolplus)

    You’re very welcome !

    Hi, you also need to return the param $request, otherwise it will not create proper order.

    return $request;

    add_filter("wpo_before_ajax_create_order", function($request ){
        if( empty($request["cart"]["customer"]["id"]) ) {
            echo json_encode( array(
                    'success' => false,
                    'data' => "You should create/select customer",
                ));
            die();
        }
    
        return $request;
    });
    • This reply was modified 3 years, 4 months ago by Nishant Kumar.
    Plugin Author algol.plus

    (@algolplus)

    Thank you for the correct code

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘force add customer (disable guest)’ is closed to new replies.