Products Sort Block
A dropdown control that allows customers to sort product listings by different criteria.
What It Does
Section titled “What It Does”The Products Sort block adds a dropdown menu for customers to change how products are ordered (price, name, newest, etc.). It works with the Products block to re-sort results.
Use cases:
- Product listing pages
- Search results
- Collection/category pages
- Shop pages
How to Add It
Section titled “How to Add It”Requirements: Must be used inside a Products block.
- Add a Products block to your page
- Click + inside the Products block
- Search for “Products sort”
- Click to insert
Block Settings
Section titled “Block Settings”Sort Options
Section titled “Sort Options”Enable/disable sort options:
- Featured - Manual ordering from BigCommerce
- Best Selling - Most purchased (requires sales data)
- Newest - Recently added products
- Oldest - Oldest products first
- A-Z - Alphabetical by product name
- Z-A - Reverse alphabetical
- Price: Low to High - Cheapest first
- Price: High to Low - Most expensive first
Default sort: Choose which option is selected on page load.
Label & Display
Section titled “Label & Display”Label text:
- “Sort by:” (default)
- “Order by:”
- Custom text
- No label (dropdown only)
Dropdown style:
- Show arrow icon
- Hide arrow icon
- Custom icon
Positioning
Section titled “Positioning”Dropzone: Place in specific layout positions within Products block:
- Above products (default)
- Below products
- Sidebar
- Toolbar
Customization
Section titled “Customization”Styling the Dropdown
Section titled “Styling the Dropdown”/* Sort dropdown container */.wpe-commerce-products-sort-control { display: flex; align-items: center; gap: 0.5rem;}
/* Label */.wpe-commerce-products-sort-control label { font-size: 0.875rem; font-weight: 500; color: #333;}
/* Dropdown select */.wpe-commerce-products-sort-control select { padding: 0.5rem 2rem 0.5rem 1rem; border: 1px solid #ddd; border-radius: 4px; font-size: 1rem; background: white; cursor: pointer;}
/* Dropdown on hover */.wpe-commerce-products-sort-control select:hover { border-color: #0073aa;}
/* Dropdown when focused */.wpe-commerce-products-sort-control select:focus { outline: 2px solid #0073aa; outline-offset: 2px;}Mobile Responsive
Section titled “Mobile Responsive”/* Stack label and dropdown on mobile */@media (max-width: 768px) { .wpe-commerce-products-sort-control { flex-direction: column; align-items: flex-start; width: 100%; }
.wpe-commerce-products-sort-control select { width: 100%; }}Common Patterns
Section titled “Common Patterns”Toolbar with Sort and Filters
Section titled “Toolbar with Sort and Filters”Horizontal toolbar above products:
Products block├── Products Sort (Above products dropzone)├── Products Filters (Above products dropzone)└── Products GridCompact Sort in Sidebar
Section titled “Compact Sort in Sidebar”Minimal sort in sidebar layout:
- Label: “Sort:”
- Dropzone: Sidebar
- Enabled options: Price, Name only
Results Toolbar
Section titled “Results Toolbar”Sort + counter + pagination:
Products block├── Products Sort├── Products Counter ("Showing 1-12 of 48 products")├── Products Grid└── Products PaginationHow It Works
Section titled “How It Works”Sort Logic
Section titled “Sort Logic”When customer selects an option:
- JavaScript captures dropdown change event
- Products block receives sort parameter
- Products block queries BigCommerce GraphQL API with new sort
- Results update without page reload
- URL updates with sort parameter (for bookmarking)
URL format:
/shop/?sort=price-asc/shop/?sort=name-desc/collection/shoes/?sort=newestDefault Sort Behavior
Section titled “Default Sort Behavior”On first page load:
- Uses default sort from block settings
- Falls back to “Featured” if no default set
- Respects URL parameter if present
When navigating:
- Preserves last selected sort
- Stores in session/local storage
- Resets when leaving site
Block Context
Section titled “Block Context”Must be used inside:
- Products block
Uses context from Products block:
wpe-commerce/productsDropzones- Available layout positionswpe-commerce/productsFullPayload- Current product datawpe-commerce/productsIsFetching- Loading state
Does not work:
- Standalone (requires parent Products block)
- Inside Single Product block
- Outside Products block
Technical Details
Section titled “Technical Details”Block name: wpe-commerce/products-sort-control
Attributes:
dropzone(string) - Layout positionsettingsId(string) - Settings reference
Supports:
- Alignment
- Custom CSS classes
Does not support:
- Multiple instances (one per Products block recommended)
- Typography controls
- Color controls from block UI
Troubleshooting
Section titled “Troubleshooting”Sort not changing products
Section titled “Sort not changing products”Check:
- Block is inside Products block
- Products block has products to display
- JavaScript is not blocked/errored
- Browser console for errors
Fix:
- Hard refresh page (Cmd+Shift+R / Ctrl+Shift+F5)
- Check browser console for JavaScript errors
- Verify Products block is fetching data correctly
Sort options not showing
Section titled “Sort options not showing”Check:
- Options enabled in block settings
- BigCommerce API returning sort data
- Products have data to sort by (prices, dates, names)
Fix:
- Edit Products Sort block
- Re-enable desired sort options in sidebar
- Save and refresh page
”Best Selling” not working
Section titled “”Best Selling” not working”Best Selling requires sales/order data from BigCommerce.
If not working:
- No orders in BigCommerce yet
- Sales data not synced
- Insufficient data to rank products
Fallback: Will show products in Featured order instead.
URL parameter not applied
Section titled “URL parameter not applied”If ?sort=price-asc in URL doesn’t sort:
Check:
- Products Sort block exists on page
- Dropdown is inside Products block
- URL parameter format is correct
Valid parameters:
featuredbest_sellingnewestoldestname-asc(A-Z)name-desc(Z-A)price-asc(Low to High)price-desc(High to Low)
Related Blocks
Section titled “Related Blocks”- Products - Parent container block
- Products Filters - Filter products by attributes
- Products Counter - Show result count
- Products Grid - Display sorted products