Wholesale_Store implements Registerable, Standard_Service

Wholesale Store Page

Tags
author

Barn2 Plugins support@barn2.com

license

GPL-3.0

copyright

Barn2 Media Ltd

Interfaces, Classes and Traits

Registerable
Standard_Service

Table of Contents

document_title_parts()  : array<string|int, mixed>
Alter the document title for the wholesale store page.
get_catalog_ordering_args()  : array<string|int, mixed>
Returns an array of arguments for ordering products based on the selected values.
get_meta_query()  : array<string|int, mixed>
Appends meta queries to an array.
get_tax_query()  : array<string|int, mixed>
Appends tax queries to an array.
handle_redirects()  : mixed
Handle page redirects.
hide_page_templates()  : array<string|int, mixed>
When editing the wholesale store page, we should hide templates.
load()  : mixed
Register WP hooks.
load_template()  : string
Load the archive-product.php template
order_by_popularity_post_clauses()  : array<string|int, mixed>
WP Core does not let us change the sort direction for individual orderby params - https://core.trac.wordpress.org/ticket/17065.
order_by_popularity_post_clauses_3_5()  : array<string|int, mixed>
WP Core doens't let us change the sort direction for individual orderby params - https://core.trac.wordpress.org/ticket/17065.
order_by_price_asc_post_clauses()  : array<string|int, mixed>
Handle numeric price sorting.
order_by_price_asc_post_clauses_3_5()  : array<string|int, mixed>
Handle numeric price sorting.
order_by_price_desc_post_clauses()  : array<string|int, mixed>
Handle numeric price sorting.
order_by_price_desc_post_clauses_3_5()  : array<string|int, mixed>
Handle numeric price sorting for WC 3.5
order_by_rating_post_clauses()  : array<string|int, mixed>
Order by rating post clauses.
page_breadcrumb()  : array<string|int, mixed>
Fix the breadcrumb
page_content()  : mixed
Load in the page content above the loop
page_title()  : string
Fix the page title
price_filter_post_clauses()  : array<string|int, mixed>
Custom query used to filter products by price.
product_query()  : mixed
Query the products, applying sorting/ordering etc.
register()  : mixed
{@inheritdoc}
remove_ordering_args()  : mixed
Remove ordering queries.
remove_ordering_args_3_5()  : mixed
Remove ordering queries.
remove_product_query_filters()  : array<string|int, mixed>
Pre_get_posts above may adjust the main query to add WooCommerce logic. When this query is done, we need to ensure all custom filters are removed.
store_products_query()  : mixed
Hijack the query and turn our normal page into a store page
unsupported_theme_shop_content_filter()  : mixed
unsupported_theme_title_filter()  : mixed
wpseo_metadesc()  : string
WP SEO meta description.
wpseo_metakey()  : string
WP SEO meta key.
append_product_sorting_table_join()  : string
Join wc_product_meta_lookup to posts if not already joined.
has_block_template()  : bool
Check whether the current theme has a block template for the given name.
is_showing_page_on_front()  : bool
Are we currently on the front page?
is_woocommerce_3_5()  : bool
Checks whether we need to include features for < WC 3.6 Plugin Activation checks we are atleast on WC 3.5
page_on_front_is()  : bool
Is the front page a page we define?

Methods

document_title_parts()

Alter the document title for the wholesale store page.

public document_title_parts(array<string|int, mixed> $title) : array<string|int, mixed>
Parameters
$title : array<string|int, mixed>

Current title parts.

Tags
Return values
array<string|int, mixed>

get_catalog_ordering_args()

Returns an array of arguments for ordering products based on the selected values.

public get_catalog_ordering_args([string $orderby = '' ][, string $order = '' ]) : array<string|int, mixed>
Parameters
$orderby : string = ''

Order by param.

$order : string = ''

Order param.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

get_meta_query()

Appends meta queries to an array.

public get_meta_query([array<string|int, mixed> $meta_query = [] ][, bool $main_query = false ]) : array<string|int, mixed>
Parameters
$meta_query : array<string|int, mixed> = []

Meta query.

$main_query : bool = false

If is main query.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

get_tax_query()

Appends tax queries to an array.

public get_tax_query([array<string|int, mixed> $tax_query = [] ][, bool $main_query = false ]) : array<string|int, mixed>
Parameters
$tax_query : array<string|int, mixed> = []

Tax query.

$main_query : bool = false

If is main query.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

handle_redirects()

Handle page redirects.

public handle_redirects() : mixed
Tags
Return values
mixed

hide_page_templates()

When editing the wholesale store page, we should hide templates.

public hide_page_templates(array<string|int, mixed> $page_templates, string $theme, WP_Post $post) : array<string|int, mixed>
Parameters
$page_templates : array<string|int, mixed>

Templates array.

$theme : string

Classname.

$post : WP_Post

The current post object.

Tags
Return values
array<string|int, mixed>

load()

Register WP hooks.

public load() : mixed
Tags
Return values
mixed

load_template()

Load the archive-product.php template

public load_template(string $template) : string
Parameters
$template : string
Tags
Return values
string

$template

order_by_popularity_post_clauses()

WP Core does not let us change the sort direction for individual orderby params - https://core.trac.wordpress.org/ticket/17065.

public order_by_popularity_post_clauses(array<string|int, mixed> $args) : array<string|int, mixed>

This lets us sort by meta value desc, and have a second orderby param.

Parameters
$args : array<string|int, mixed>

Query args.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

order_by_popularity_post_clauses_3_5()

WP Core doens't let us change the sort direction for individual orderby params - https://core.trac.wordpress.org/ticket/17065.

public order_by_popularity_post_clauses_3_5(array<string|int, mixed> $args) : array<string|int, mixed>

This lets us sort by meta value desc, and have a second orderby param.

Parameters
$args : array<string|int, mixed>

Query args.

Tags
Return values
array<string|int, mixed>

order_by_price_asc_post_clauses()

Handle numeric price sorting.

public order_by_price_asc_post_clauses(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

order_by_price_asc_post_clauses_3_5()

Handle numeric price sorting.

public order_by_price_asc_post_clauses_3_5(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

Tags
Return values
array<string|int, mixed>

order_by_price_desc_post_clauses()

Handle numeric price sorting.

public order_by_price_desc_post_clauses(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

order_by_price_desc_post_clauses_3_5()

Handle numeric price sorting for WC 3.5

public order_by_price_desc_post_clauses_3_5(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

order_by_rating_post_clauses()

Order by rating post clauses.

public order_by_rating_post_clauses(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
array<string|int, mixed>

page_breadcrumb()

Fix the breadcrumb

public page_breadcrumb(array<string|int, mixed> $crumbs, WC_Breadcrumb $breadcrumb) : array<string|int, mixed>
Parameters
$crumbs : array<string|int, mixed>
$breadcrumb : WC_Breadcrumb
Tags
Return values
array<string|int, mixed>

$crumbs

page_content()

Load in the page content above the loop

public page_content() : mixed
Tags
Return values
mixed

page_title()

Fix the page title

public page_title(string $page_title) : string
Parameters
$page_title : string
Tags
Return values
string

$page_title

price_filter_post_clauses()

Custom query used to filter products by price.

public price_filter_post_clauses(array<string|int, mixed> $args, WC_Query $wp_query) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Query args.

$wp_query : WC_Query

WC_Query object.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

since
3.6.0
Return values
array<string|int, mixed>

product_query()

Query the products, applying sorting/ordering etc.

public product_query(WP_Query $q) : mixed
Parameters
$q : WP_Query

Query instance.

Tags
Return values
mixed

register()

{@inheritdoc}

public register() : mixed
Tags
Return values
mixed

remove_ordering_args()

Remove ordering queries.

public remove_ordering_args() : mixed
Tags
Return values
mixed

remove_ordering_args_3_5()

Remove ordering queries.

public remove_ordering_args_3_5() : mixed
Tags
Return values
mixed

remove_product_query_filters()

Pre_get_posts above may adjust the main query to add WooCommerce logic. When this query is done, we need to ensure all custom filters are removed.

public remove_product_query_filters(array<string|int, mixed> $posts) : array<string|int, mixed>

This is done here during the_posts filter. The input is not changed.

Parameters
$posts : array<string|int, mixed>

Posts from WP Query.

Tags
Return values
array<string|int, mixed>

store_products_query()

Hijack the query and turn our normal page into a store page

public store_products_query(WP_Query $q) : mixed
Parameters
$q : WP_Query
Tags
Return values
mixed

unsupported_theme_shop_content_filter()

public unsupported_theme_shop_content_filter(mixed $content) : mixed
Parameters
$content : mixed
Tags
Return values
mixed

unsupported_theme_title_filter()

public unsupported_theme_title_filter(mixed $title) : mixed
Parameters
$title : mixed
Tags
Return values
mixed

wpseo_metadesc()

WP SEO meta description.

public wpseo_metadesc() : string
Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Hooked into wpseo_ hook already, so no need for function_exist.

Return values
string

wpseo_metakey()

WP SEO meta key.

public wpseo_metakey() : string
Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Hooked into wpseo_ hook already, so no need for function_exist.

Return values
string

append_product_sorting_table_join()

Join wc_product_meta_lookup to posts if not already joined.

private append_product_sorting_table_join(string $sql) : string
Parameters
$sql : string

SQL join.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
string

has_block_template()

Check whether the current theme has a block template for the given name.

private has_block_template(string $template_name) : bool
Parameters
$template_name : string
Tags
Return values
bool

is_showing_page_on_front()

Are we currently on the front page?

private is_showing_page_on_front(WP_Query $q) : bool
Parameters
$q : WP_Query

Query instance.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
bool

is_woocommerce_3_5()

Checks whether we need to include features for < WC 3.6 Plugin Activation checks we are atleast on WC 3.5

private is_woocommerce_3_5() : bool
Tags
Return values
bool

page_on_front_is()

Is the front page a page we define?

private page_on_front_is(int $page_id) : bool
Parameters
$page_id : int

Page ID.

Tags
see
WC_Query

woocommerce/includes/class-wc-query.php

Return values
bool

Search results