Product_Visibility

This class represents a WooCommerce product with various functions to test its visibility.

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Table of Contents

$product  : mixed
$roles  : mixed
$visibility  : mixed
__construct()  : mixed
Constructor.
get_product()  : WC_Product
Get product
get_roles()  : array<string|int, mixed>
Get roles.
get_visibility()  : string
Get visibility.
has_protection()  : bool
Does this product have protection?
has_wholesale_exclusion()  : bool
Does this product have wholesale exclusion?
has_wholesale_protection()  : bool
Does this product have wholesale protection?
is_exclusion_unlocked()  : bool
Is this product unlocked by role?
is_protected()  : bool
Is this product protected?
is_protection_unlocked()  : bool
Is this product unlocked by role?
is_public()  : bool
Is this product public?
is_public_unlocked()  : bool
Is this public unlocked.
is_unlocked()  : bool
Is this product unlocked by password, role, user, or for private access?
current_user_allowed_by_role()  : bool
Determine if the current user is allowed by role.

Properties

Methods

__construct()

Constructor.

public __construct(WC_Product $product) : mixed
Parameters
$product : WC_Product
Tags
Return values
mixed

get_product()

Get product

public get_product() : WC_Product
Tags
Return values
WC_Product

get_roles()

Get roles.

public get_roles() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed>

get_visibility()

Get visibility.

public get_visibility() : string
Tags
Return values
string

has_protection()

Does this product have protection?

public has_protection() : bool
Tags
Return values
bool

true if protected

has_wholesale_exclusion()

Does this product have wholesale exclusion?

public has_wholesale_exclusion() : bool
Tags
Return values
bool

true if role protected

has_wholesale_protection()

Does this product have wholesale protection?

public has_wholesale_protection() : bool
Tags
Return values
bool

true if role protected

is_exclusion_unlocked()

Is this product unlocked by role?

public is_exclusion_unlocked() : bool
Tags
Return values
bool

true if role protected and the current user has one of the required roles.

is_protected()

Is this product protected?

public is_protected() : bool
Tags
Return values
bool

true if this product is protected.

is_protection_unlocked()

Is this product unlocked by role?

public is_protection_unlocked() : bool
Tags
Return values
bool

true if role protected and the current user has one of the required roles.

is_public()

Is this product public?

public is_public() : bool
Tags
Return values
bool

true if public.

is_public_unlocked()

Is this public unlocked.

public is_public_unlocked() : bool
Tags
Return values
bool

is_unlocked()

Is this product unlocked by password, role, user, or for private access?

public is_unlocked() : bool
Tags
Return values
bool

true if unlocked.

current_user_allowed_by_role()

Determine if the current user is allowed by role.

private current_user_allowed_by_role() : bool
Tags
Return values
bool

Search results