In our Webstore, a user can select a buyer account (from a list of accounts from the Account-Contact relationships) to create a webcart. But it looks like it's not allowed if the user's contact is not directly related to the Account (??). I got the following error:
ConnectApi.ConnectApiException: Argument: '{Account Id}' - You can't buy for this account.
The webcart is created successfully if the owner is directly related to the account.
Here's the sample code:
ConnectApi.CartInput cartInput = new ConnectApi.CartInput();
cartInput.effectiveAccountId = {related account Id};
cartInput.name = 'Some cart';
cartInput.type= ConnectApi.CartType.Cart;
ConnectApi.CommerceCart.createCart(storeId, cartInput);
Am I missing something? I can't find any doc regarding the direct contact limitation. If this is indeed a limitation, is there a way around this?
Cheers!