WooCommerce Code Reference

WC_Shortcodes
in package

WooCommerce Shortcodes class.

Table of Contents

best_selling_products()  : string
List best selling products on sale.
cart()  : string
Cart page shortcode.
checkout()  : string
Checkout page shortcode.
featured_products()  : string
Output featured products.
init()  : mixed
Init shortcodes.
my_account()  : string
My account page shortcode.
order_by_rating_post_clauses()  : array
Order by rating.
order_tracking()  : string
Order tracking page shortcode.
product()  : string
Display a single product.
product_add_to_cart()  : string
Display a single product price + cart button.
product_add_to_cart_url()  : string
Get the add to cart URL for a product.
product_attribute()  : string
List products with an attribute shortcode.
product_categories()  : string
List all (or limited) product categories.
product_category()  : string
List products in a category shortcode.
product_page()  : string
Show a single product page.
products()  : string
List multiple products shortcode.
recent_products()  : string
Recent Products shortcode.
related_products()  : string
List related products.
sale_products()  : string
List all products on sale.
shop_messages()  : string
Show messages.
shortcode_wrapper()  : string
Shortcode Wrapper.
top_rated_products()  : string
List top rated products on sale.

Methods

best_selling_products()

List best selling products on sale.

public static best_selling_products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

checkout()

Checkout page shortcode.

public static checkout(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

Output featured products.

public static featured_products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

my_account()

My account page shortcode.

public static my_account(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

order_by_rating_post_clauses()

Order by rating.

public static order_by_rating_post_clauses(array $args) : array
Parameters
$args : array

Query args.

Tags
deprecated
3.2.0

Use WC_Shortcode_Products::order_by_rating_post_clauses().

Return values
array

order_tracking()

Order tracking page shortcode.

public static order_tracking(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

product()

Display a single product.

public static product(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

product_add_to_cart()

Display a single product price + cart button.

public static product_add_to_cart(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

product_add_to_cart_url()

Get the add to cart URL for a product.

public static product_add_to_cart_url(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

product_attribute()

List products with an attribute shortcode.

public static product_attribute(array $atts) : string

Example [product_attribute attribute="color" filter="black"].

Parameters
$atts : array

Attributes.

Return values
string

product_categories()

List all (or limited) product categories.

public static product_categories(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

product_category()

List products in a category shortcode.

public static product_category(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

product_page()

Show a single product page.

public static product_page(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

products()

List multiple products shortcode.

public static products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

recent_products()

Recent Products shortcode.

public static recent_products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

List related products.

public static related_products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

sale_products()

List all products on sale.

public static sale_products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string

shortcode_wrapper()

Shortcode Wrapper.

public static shortcode_wrapper(string[] $function[, array $atts = array() ][, array $wrapper = array('class' => 'woocommerce', 'before' => null, 'after' => null) ]) : string
Parameters
$function : string[]

Callback function.

$atts : array = array()

Attributes. Default to empty array.

$wrapper : array = array('class' => 'woocommerce', 'before' => null, 'after' => null)

Customer wrapper data.

Return values
string

top_rated_products()

List top rated products on sale.

public static top_rated_products(array $atts) : string
Parameters
$atts : array

Attributes.

Return values
string