Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
Before everyone gets all excited and explains how to go into a collection and change the sort, we all know that.
What I want to know is why does it default to best selling. We have 100s, if not 1000s of collections.
Also when we make a collection, you can't set the default sort until its down processing.
You could be waiting 10 minutes or need to go back.
I want a new collection to DEFAULT to A-Z order.
What is the point of "Best Selling" if its new merchandise.
Customers don't care about "best selling" lists. They know they are fake.
Hi,
You can use Shopify Admin API
1. You need to create private app to get API credentials
2. Python script to fetch collections and update sort order.
Example of Script
import requests
import json
# Replace with your actual values
API_KEY = 'your_api_key'
PASSWORD = 'your_api_password'
SHOP_NAME = 'your_shop_name'
API_VERSION = '2021-04'
def get_collections():
url = f"https://{API_KEY}:{PASSWORD}@{SHOP_NAME}.myshopify.com/admin/api/{API_VERSION}/custom_collections.json"
response = requests.get(url)
return response.json()['custom_collections']
def update_collection_sort_order(collection_id):
url = f"https://{API_KEY}:{PASSWORD}@{SHOP_NAME}.myshopify.com/admin/api/{API_VERSION}/custom_collections/{collection_id}.json"
data = {
"custom_collection": {
"id": collection_id,
"sort_order": "alpha-asc"
}
}
response = requests.put(url, json=data)
return response.json()
def main():
collections = get_collections()
for collection in collections:
if collection['sort_order'] != 'alpha-asc':
update_collection_sort_order(collection['id'])
print(f"Updated collection {collection['id']} to A-Z order")
if __name__ == "__main__":
main()
3. Schedule script to run at regular intervals.
Hope this will help
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024