Jump to content

SparkCreative

Circle Member
  • Posts

    1
  • Joined

  • Last visited

Community Answers

  1. SparkCreative's post in Alphabetically sorting products in product pages was marked as the answer   
    In case there are people seeking help with this for 7.1 (as I recently did but came up empty-handed), here is a JS code that can be inserted within the <head> tag (Settings > Developer Tools > Code Injection). 
     
    <script> window.addEventListener('load', function() { var container = document.querySelector('.list-grid'); var items = Array.from(container.getElementsByClassName('grid-item')); items.sort(function(a, b) { var titleA = a.querySelector('.grid-title').textContent.trim().toLowerCase(); var titleB = b.querySelector('.grid-title').textContent.trim().toLowerCase(); if (titleA < titleB) { return -1; } if (titleA > titleB) { return 1; } return 0; }); container.innerHTML = ''; items.forEach(function(item) { container.appendChild(item); }); }); </script>  
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.