Home > widget-integration > RESPONSE_TYPE
RESPONSE_TYPE variable
API response format types.
Specifies whether the filter API should return JSON data or pre-rendered HTML.
Signature:
RESPONSE_TYPE: {
readonly JSON: "json";
readonly HTML: "html";
}
Remarks
Use JSON for programmatic processing and HTML for direct DOM injection. Most shops use JSON format for better flexibility and client-side rendering control.
Example
Customize response type based on shop requirements:
window.boostWidgetIntegration.extend('FilterAPI', (FilterAPI) => {
return class extends FilterAPI {
async getProductByFilter(params, additions) {
// Force JSON response for custom processing
const customAdditions = {
...additions,
responseType: RESPONSE_TYPE.JSON
};
return super.getProductByFilter(params, customAdditions);
}
};
});