Wrong JSON Data from GET being returned

New Member
3 0 0

I've recently created an alternate template with {% layout none %} for my collection pages that returns custom JSON for products within my collection pages. This gives me a way to store custom metafield strings within the JSON to use in jQuery for collection filtering. The file is called collection.filter-json.liquid and when going to a collection page and adding the ?view=filter-json to the link it returns the correct JSON and I can see all the fields in there I need.

However, when I go to a collection page and click a checkbox (to filter by tag) that completes the action that calls the AJAX GET, the JSON that is returned is just the collection.json and is not the {collection_url}?view=filter-json as I was hoping for. Can't quite figure out where the disconnect is or why it is only returning the collection.json and not my custom JSON.


var coll_url = window.location.href;

function getFilterProducts(tag){
        type: 'GET',
        url: coll_url,
        data: {
            'view': 'filter-json'
        dataType: "json",
        success: function(res){
         // for testing
        error: function(status){


When testing, console.log(res); returns just the collection.json but console.log(this.url); returns the full {collection_url}?view=filter-json URL.