woocommerce product orderby ID with custom order(N

2019-08-28 03:30发布

问题:

i have used shortcode '[products ids="1,3,2" orderby="ID"]' to get the products with id 1,3,2. on page display, product showing as 3,2,1 if using order parameter it will display in ASC order or DESC order. but my order should be 1,3,2. how can i achieve it.

Thanks in Advance.

回答1:

Try this:

[products ids="1,3,2" orderby="menu_order"]

Then try the order attribute



回答2:

To order products in the order you want, first collect your products id, then use: [products number="12" orderby="id" id="10,18"]

Change the number by the number of products you want to display, and the IDs by yours.

It works with categories too: [product_categories number="12" orderby="id" id="10,18"]