• Resolved ididthat

    (@ididthat)


    We have a use case where multiple users enter orders on a private website. They all share the same address book. In previous versions, we simply edited $user_id = 8 and hard coded that in the plugin. All the users shared and edited the same address book.

    With the recent changes in version 3+ we were faced with the same issue. Seemed simple enough just to modify – “function get_current_customer” to return $user_id = 8. But this doesn’t work, It just runs in a loop until it finally times out.

    Any suggestions on how we can get all the users on a single site to use the same address book?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Matt Harrison

    (@matt-h)

    Hi,

    I’m not sure what you changed the function to, but my guess is because it needs to return a customer object and not an id it was not working.

    That said, we have a filter in place so you can do this by adding the code to either your theme or through a custom plugin. That way you don’t need to be modifying the plugin every time we release a new version update.

    You can add this filter to override it:

    add_filter(
    'wc_address_book_current_user_id',
    function ( $user_id ) {
    return 8;
    }
    );
    Thread Starter ididthat

    (@ididthat)

    Thank you. That worked as soon as I used a different user_id. (Not 8 that we had been using for a few years)

    I realized the number of addresses for this user has gotten so large they won’t load.
    For this user:
    wc_address_book_shipping = 451 KB
    wc_address_book_billing = 286 KB
    wc_address_book = 219 KB
    That seems to choke the page load.

    Can I suggest a feature for a future version to be able to trim the address book by date or keep the XX most recent addresses?


    Plugin Author Matt Harrison

    (@matt-h)

    Interesting. A huge address book could cause issues. I could see us adding a sort of pagination feature to it which would probably solve the page load issue you are having.

    Thread Starter ididthat

    (@ididthat)

    If it helps. The users primarily rely on auto-complete with the large list. They don’t manually select a name, they just start typing. I would imagine most users with very large lists would be doing the same.
    thanks
    -=theron

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.