Sort Products in Cart and Order

Sort Products in Cart and Order allows your WooCommerce store to sort the products in the cart, order, and order emails using various sorting options. It also lets you add extra sorting options to the shop and product archive pages, and override the sorting method on individual orders.

Installation

↑ Back to top
  • Download the .zip file from your WooCommerce account.
  • Go to: WordPress Admin > Plugins > Add New > Upload and select the ZIP file you just downloaded.
  • Install Now and Activate the extension.

More information at: Install and Activate Plugins/Extensions.

Setup

↑ Back to top

All settings for this plugin are located under WooCommerce > Settings > Products > Sort Products in Cart/Order. The settings are grouped into three sections, described below.

Basic Sorting Settings

↑ Back to top
  • Select Enable Sorting to turn on the plugin functionality for the cart, order, and email notifications.
  • Choose your preferred sorting method in Sort Product(s) By. See the Sorting Options Reference section below for the full list of available options.
  • If you select any of the Product Attribute sorting options, choose the attribute to use in the Select Attribute dropdown.
  • If you select any of the Custom Field sorting options, enter the product meta key in the Enter Custom Field Key field. The value of this meta key will be used for sorting.
  • Click Save changes to save the settings.

Custom Order Sorting

↑ Back to top

This section lets you override the global sorting method for individual orders — useful when a specific order needs a different item order than the store default.

  • Enable Enable Custom Sorting on Edit Order Page to display a Custom Product Sorting meta box in the sidebar of the order edit screen (works with both the legacy order screen and HPOS).
  • In the meta box, select a sorting method for that order. Choose Use Global Settings to fall back to the store-wide sorting method.
  • If you choose a Custom Field sorting option, provide the custom field key in the field that appears. If you choose a Product Attribute sorting option, select the attribute in the dropdown that appears.
  • Update the order to save the per-order sorting. The override is stored as order meta, so it is preserved across future order views and emails.

Archive Page Sorting

↑ Back to top

This section lets you add extra options to the Sort by dropdown on the shop page and product archive pages, alongside the default WooCommerce options.

  • In Sorting options on archive page, select the options you want to expose to shoppers. Leave the field empty to keep only the default WooCommerce sorting options.
  • The Custom Field archive options require a valid Custom Field Key to be set in the Basic Sorting Settings section; they are automatically hidden from the dropdown if no key is configured.
  • Click Save changes to apply.

Usage

↑ Back to top

Cart, Order, and Emails

↑ Back to top

After enabling sorting, products in the cart will be sorted using the selected method. The same sorting is applied to the order line items and to order emails once the customer checks out, so the item order remains consistent throughout the entire purchase cycle.

For example, if Ascending is selected, all customers will see their cart items sorted alphabetically (A → Z), and the resulting order and order emails will show the same order. The same principle applies to every sorting method — product SKU, category, attribute, price, menu order, date, popularity, rating, weight, and custom field.

Beyond the sorting methods that WooCommerce already provides (stock status, menu order, SKU, category, etc.), this plugin also supports sorting by product custom fields. To use this, enter the custom field key in Custom Field Key and select one of the Custom Field sorting options. The value of that meta key will be used as the sort value.

Per-Order Override

↑ Back to top

When Custom Sorting on Edit Order Page is enabled, open any order from WooCommerce > Orders. In the Custom Product Sorting meta box, choose a different sorting method for that order only. Leave it as Use Global Settings to inherit the store-wide method. This override affects how line items are ordered for that specific order (and its emails) without changing the global setting.

Archive Page Sorting

↑ Back to top

Any options selected in Sorting options on archive page appear in the Sort by dropdown on the shop and product archive pages. The default WooCommerce options remain available. Shoppers can pick any of these options to re-order the product grid, and the choice is remembered by WooCommerce in the usual way.

HPOS Compatibility

↑ Back to top

The plugin is compatible with WooCommerce High-Performance Order Storage (HPOS) and the new orders cache. The custom sorting meta box and per-order override work correctly whether orders are stored in the legacy post table or the HPOS tables.

Sorting Options Reference

↑ Back to top

Cart and Order Sorting Options

↑ Back to top
  • Ascending — product name, A → Z.
  • Descending — product name, Z → A.
  • Price Low to High — lowest unit price first.
  • Price High to Low — highest unit price first.
  • Product SKU – Ascending / Descending — sorted by SKU.
  • Product Category – Ascending / Descending — sorted by the first product category name.
  • Product Category – Ascending / Descending : Order — sorted by the category’s term order value.
  • Product Attribute – Ascending / Descending — sorted by the selected attribute.
  • Menu Order – Ascending / Descending — sorted by the product menu order.
  • Date – Old / Latest — sorted by product creation date.
  • Popularity — sorted by total sales.
  • Rating — sorted by average rating.
  • Light Weight / Heavy Weight Product — sorted by product weight.
  • Custom Field – Ascending / Descending — sorted by the value of the custom field key you configured.

Archive Page Sorting Options

↑ Back to top
  • Sort by name: A to Z
  • Sort by name: Z to A
  • Sort by SKU: ascending
  • Sort by SKU: descending
  • Sort by oldest
  • Sort by menu order: descending
  • Sort by weight: light to heavy
  • Sort by weight: heavy to light
  • Sort by custom field: ascending
  • Sort by custom field: descending

Products without a value for the SKU, weight, or custom field are kept in the results and listed after products that do have a value.

Related Products

WooCommerce Subscriptions is a WooCommerce extension that lets customers subscribe to your products or...

Offer add-ons like gift wrapping, special messages or other special options for your products.

Use of your personal data
We and our partners process your personal data (such as browsing data, IP Addresses, cookie information, and other unique identifiers) based on your consent and/or our legitimate interest to optimize our website, marketing activities, and your user experience.