• Resolved tbaikamine

    (@tbaikamine)


    am using this function to programatically create an order, it only works when am logged-in as administrator, and returns -1 when am logged-in as a customer !
    thank you so much for your help.

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

    (@tbaikamine)

    found a working solution :
    since what makes difference between two user’s roles (administrator and a customer in our case)
    is the user’s capabilities !
    so after a lot of trials i found that the user really needs the “manage_options” capability to be able to use the function ! (strange)

    $user = new WP_User(get_current_user_id());
    $user->add_cap('manage_options');

    without the user’s being able to see the Administration panel
    this capability wont do any good for the user, and certainly no harm for the website
    but still, it’s a bug !

Viewing 1 replies (of 1 total)
  • The topic ‘wc_create_order not working’ is closed to new replies.