WooCommerce Code Reference

WC_Shortcode_Products
in package

Products shortcode class.

Table of Contents

$attributes  : array
Attributes.
$custom_visibility  : bool
Set custom visibility.
$query_args  : array
Query args.
$type  : string
Shortcode type.
__construct()  : mixed
Initialize shortcode.
get_attributes()  : array
Get shortcode attributes.
get_content()  : string
Get shortcode content.
get_query_args()  : array
Get query args.
get_type()  : array
Get shortcode type.
order_by_rating_post_clauses()  : array
Order by rating.
set_product_as_visible()  : bool
Set product as visible when querying for hidden products.
get_query_results()  : object
Run the query and return an array of data, including queried ids and pagination information.
get_transient_name()  : string
Generate and return the transient name for this shortcode based on the query args.
get_wrapper_classes()  : array
Get wrapper classes.
parse_attributes()  : array
Parse attributes.
parse_legacy_attributes()  : array
Parse legacy attributes.
parse_query_args()  : array
Parse query args.
product_loop()  : string
Loop over found products.
set_attributes_query_args()  : mixed
Set attributes query args.
set_best_selling_products_query_args()  : mixed
Set best selling products query args.
set_categories_query_args()  : mixed
Set categories query args.
set_ids_query_args()  : mixed
Set ids query args.
set_sale_products_query_args()  : mixed
Set sale products query args.
set_skus_query_args()  : mixed
Set skus query args.
set_tags_query_args()  : mixed
Set tags query args.
set_top_rated_products_query_args()  : mixed
Set top rated products query args.
set_visibility_catalog_query_args()  : mixed
Set visibility as catalog.
set_visibility_featured_query_args()  : mixed
Set visibility as featured.
set_visibility_hidden_query_args()  : mixed
Set visibility as hidden.
set_visibility_query_args()  : mixed
Set visibility query args.
set_visibility_search_query_args()  : mixed
Set visibility as search.

Properties

Methods

__construct()

Initialize shortcode.

public __construct([array $attributes = array() ][, string $type = 'products' ]) : mixed
Parameters
$attributes : array = array()

Shortcode attributes.

$type : string = 'products'

Shortcode type.

Tags
since
3.2.0
Return values
mixed

set_product_as_visible()

Set product as visible when querying for hidden products.

public set_product_as_visible(bool $visibility) : bool
Parameters
$visibility : bool

Product visibility.

Tags
since
3.2.0
Return values
bool

get_query_results()

Run the query and return an array of data, including queried ids and pagination information.

protected get_query_results() : object
Tags
since
3.3.0
Return values
objectObject with the following props; ids, per_page, found_posts, max_num_pages, current_page

set_attributes_query_args()

Set attributes query args.

protected set_attributes_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_best_selling_products_query_args()

Set best selling products query args.

protected set_best_selling_products_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_categories_query_args()

Set categories query args.

protected set_categories_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_sale_products_query_args()

Set sale products query args.

protected set_sale_products_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_top_rated_products_query_args()

Set top rated products query args.

protected set_top_rated_products_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.6.5
Return values
mixed

set_visibility_catalog_query_args()

Set visibility as catalog.

protected set_visibility_catalog_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

Set visibility as featured.

protected set_visibility_featured_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_visibility_hidden_query_args()

Set visibility as hidden.

protected set_visibility_hidden_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_visibility_query_args()

Set visibility query args.

protected set_visibility_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed

set_visibility_search_query_args()

Set visibility as search.

protected set_visibility_search_query_args(array &$query_args) : mixed
Parameters
$query_args : array

Query args.

Tags
since
3.2.0
Return values
mixed