-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Shortcodes changes in 3.2.0
Shortcodes has been improved on WooCommerce 3.2.0, see the changes:
Some of the attributes have gained a new names.
-
per_pagenow is calledlimit. -
operatornow is calledcat_operator. -
filternow is calledterms.
All changes has been made to make the attributes clearer and easier to use.
Note that the old names will still work without generating any warning or deprecated notice.
The [products] shortcode has been improved on WooCommerce 3.2, allowing fetch products by ids, SKUs, categories, attributes, and more, replacing the need for multiples shortcodes like [product_category], [featured_products], [sale_products], [best_selling_products], [recent_products], [product_attribute], and [top_rated_products].
-
limit- Results limit. Defaults to-1. -
columns- Number of columns. Defaults to4. -
orderby- Sort retrieved products by parameter. Available options:menu_order,title,date,rand,price,popularity,rating, orid. Defaults totitle. One or more options can be passed separated by empty spaces. -
order- Designates the order of theorderbyattribute. Available options:ASCandDESC. Defaults toASC. -
ids- Comma separated list of product IDs. -
skus- Comma separated list of product SKUs. -
category- Comma separated list of category slugs. -
cat_operator- Operator to compare categories. Available options:AND,IN, andNOT IN. Defaults toIN. -
attribute- Retrieved products based on an attribute slug. -
terms- Comma separated list of attribute terms to be used withattribute. -
terms_operator- Operator to compare attribute terms. Available options:AND,IN, andNOT IN. Defaults toIN. -
visibility- Retrieve products based on visibility. Available options:visible(visible on shop and search results),catalog(visible on shop only),search(visible on search results only), andhidden. Defaults tovisible. -
class- Shortcode wrapper HTML class. -
on_sale- Retrieve on sale products. Not to be used in conjunction withbest_sellingortop_rated. -
best_selling- Retrieve best selling products. Not to be used in conjunction withon_saleortop_rated. -
top_rated- Retrieve top rated products. Not to be used in conjunction withon_saleorbest_selling.
Check the follow examples that replaces our old shortcodes.
[products category="clothing" limit="4" orderby="menu_order title" order="ASC"]
[products attribute="color" terms="black" limit="4" orderby="title" order="ASC"]
[products ids="1,2,3,4,5,6"]
[products skus="foo,bar,baz"]
[products limit="4" orderby="date" order="DESC"]
[products on_sale="true" limit="4" orderby="title" order="ASC"]
[products best_selling="true" limit="4"]
[products top_rated="true" limit="4" orderby="title" order="ASC"]
[products visibility="featured" limit="4" orderby="date" order="DESC"]
WooCommerce is an open source commerce platform built for WordPress and lovingly crafted by Automattic and the WooCommerce community 💜. Come and work with us!
Contribution
- Set up development environment
- Our Git Flow
- SCSS and JS minification
- Naming conventions
- CSS SASS coding guidelines and naming conventions
- Critical Flows
- API Critical Flows
- String localisation guidelines
- Translating WooCommerce
- Deprecation in core
- Adding Actions and Filters
- Common Issues
- Writing high-quality testing instructions
Release Notes
- Release Testing Instructions
- 3.6.x notes/FAQ
- 2.6.x to 3.0.0 Developer Migration Notes
- Select2 fields not working in 3.0.x
- Thumbnail Image Regeneration in 3.3+
- Customizing image sizes in 3.3+
REST API and CLI
CRUD & Data Descriptions
- Database Description
- CRUD Objects in 3.0
- Order and Order Line Item Data
- Coupon Data
- Customer Data
- Product Data
- Data Stores
Internal APIs
Theming
- Enabling product gallery features (zoom, swipe, lightbox)
- Template File Guidelines for Devs and Theme Authors
Examples / Guides