Created
February 5, 2024 05:35
-
-
Save osama2kabdullah/47ba37b22046d84c4422f86350b23fa2 to your computer and use it in GitHub Desktop.
Shopify Collection Filter AJAX request URL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shopify.queryParams = {}; | |
if (location.search.length) { | |
var params = location.search.substr(1).split("&"); | |
$.each(params, function (i, param) { | |
var keyValue = param.split("="); | |
if (keyValue.length) { | |
Shopify.queryParams[decodeURIComponent(keyValue[0])] = | |
decodeURIComponent(keyValue[1]); | |
} | |
}); | |
} | |
Shopify.queryParams.sort_by = "best-selling"; // you can change it by dynamically | |
const view_all_URL = location.origin + location.pathname + "?" + $.param(Shopify.queryParams); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment