[ { "label": "Set Collection's Default Sort Option", "trigger_type": [ "collection_created" ], "object_type": "collection", "app_id": "triggers", "settings": { "priority": 0, "condition_groups": { "1": { "conditions": [], "actions": { "1": { "type": "shopify_graphql_request", "settings": { "token_object_type": "collection", "query_wrapper": { "query": "mutation collectionUpdate($input: CollectionInput!) {\r\n collectionUpdate(input: $input) {\r\n collection {\r\n id\r\n title\r\n sortOrder\r\n }\r\n userErrors {\r\n field\r\n message\r\n }\r\n }\r\n}\r\n" }, "label": "Set a collections default sort order", "query_type_mode_wrapper": { "query_type_mode": "graphql" }, "query_change_editor_wrapper": { "query_change_editor": "Use Twig Editor" }, "variables": "{\r\n \"input\": {\r\n \"id\": \"gid:\/\/shopify\/Collection\/{{collection.id}}\",\r\n \"sortOrder\": \"CREATED_DESC\"\r\n }\r\n}\r\n", "twig": "{{ response | debug }}", "wait": "0", "cw_timezone": "Africa\/Nairobi", "custom_wait": "", "run_once": 0 }, "weight": 999, "target_key": "collection" } } } }, "instructions": "Valid values\r\nReference: [Shopify API - CollectionSortOrder Enum](https:\/\/shopify.dev\/docs\/api\/admin-graphql\/2023-01\/enums\/CollectionSortOrder)\r\n\r\n- `ALPHA_ASC`: Alphabetically, in ascending order (A - Z).\r\n- `ALPHA_DESC`: Alphabetically, in descending order (Z - A).\r\n- `BEST_SELLING`: By best-selling products.\r\n- `CREATED`: By date created, in ascending order (oldest - newest).\r\n- `CREATED_DESC`: By date created, in descending order (newest - oldest).\r\n- `MANUAL`: In the order set manually by the merchant.\r\n- `PRICE_ASC`: By price, in ascending order (lowest - highest).\r\n- `PRICE_DESC`: By price, in descending order (highest - lowest).\r\n", "shared_workflow_id": 247477 }, "description": "This automation is fired when a collection is created and then it sets the collection's default sort order for the products to pre-defined options. This workflow is very helpful for stores where the collections are created by an external app" } ]