Automattic\WooCommerce\Internal\ShopperLists
ShopperList::get_by_slug_raw
Load a list by slug without the feature-flag gate, for internal callers (e.g. privacy export/erase). Do not use for user-facing reads.
Method of the class: ShopperList{}
No Hooks.
Returns
self|false.
Usage
$result = ShopperList::get_by_slug_raw( $slug, ?int $user_id );
- $slug(string) (required)
- List identifier.
- ?int $user_id
- .
Default:null
ShopperList::get_by_slug_raw() ShopperList::get by slug raw code WC 11.0.1
public static function get_by_slug_raw( string $slug, ?int $user_id = null ) {
if ( ! in_array( $slug, wc_get_container()->get( ShopperListsController::class )->get_supported_slugs(), true ) ) {
return false;
}
$user_id = absint( $user_id ? $user_id : get_current_user_id() );
if ( ! $user_id ) {
return false;
}
$stored = Users::get_site_user_meta( $user_id, self::META_KEY_PREFIX . $slug );
if ( is_array( $stored ) ) {
return self::from_array( $stored, $user_id );
}
return new self(
$user_id,
$slug,
current_time( 'mysql', true ),
array()
);
}