Skip to content

Commit d1a8960

Browse files
mjoslynclaude
andcommitted
docs: clarify multi-account resolution is opt-in (no default resolver)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5d84c87 commit d1a8960

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

docs/concepts/multi-account.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ Many B2B stores let a business account have multiple logins (a primary account p
44
sub-accounts) that should all be priced the same. WC Pricebook supports this with a
55
single resolution point.
66

7+
::: tip Opt-in — no default
8+
Multi-account resolution is **opt-in**. The plugin ships **no** default resolver: out of
9+
the box the `wc_pricebook_pricing_user` filter returns the logged-in user unchanged, so
10+
every account is priced as itself. Add the filter below to enable sub-accounts. (There's
11+
no universal "sub-account" model in WooCommerce, so the plugin can't guess the parent
12+
relationship — you point it at whatever meta/plugin links your accounts.)
13+
:::
14+
715
## The resolved pricing user
816

917
Everything — pricing, visibility, force overrides, category-role mappings — runs on the
@@ -13,6 +21,8 @@ parent resolution once, in the `wc_pricebook_pricing_user` filter:
1321
```php
1422
add_filter( 'wc_pricebook_pricing_user', function ( $user ) {
1523
// Return the parent WP_User when $user is a sub-account.
24+
// 'parent_account' is a placeholder — use whatever meta key (or B2B/membership
25+
// plugin API) your store already uses to link a sub-account to its parent.
1626
$parent_id = (int) get_user_meta( $user->ID, 'parent_account', true );
1727
return $parent_id ? get_user_by( 'id', $parent_id ) : $user;
1828
} );

0 commit comments

Comments
 (0)