diff --git a/components/models/index.tsx b/components/models/index.tsx
index 2f91d1418..937e2b3f1 100644
--- a/components/models/index.tsx
+++ b/components/models/index.tsx
@@ -1,24 +1,18 @@
import { GlobeAltIcon } from '@heroicons/react/24/outline';
-import { MAKE_FILTER_ID, MODEL_FILTER_ID } from 'lib/constants';
+import { MODEL_FILTER_ID } from 'lib/constants';
import { getProductFilters } from 'lib/shopify';
import { getCollectionUrl } from 'lib/utils';
import Link from 'next/link';
-const Models = async ({
- collectionHandle,
- make
-}: {
- collectionHandle: string;
- make?: string | string[];
-}) => {
- // eg: collectionHandle = transmission-bmw-x5
- const makeFromCollectionHandle = collectionHandle.split('-')[1];
+const Models = async ({ collectionHandle }: { collectionHandle: string }) => {
+ // eg: collectionHandle = transmission_bmw_x5
+ const makeFromCollectionHandle = collectionHandle.split('_')[1];
- if (!makeFromCollectionHandle && !make) {
+ if (!makeFromCollectionHandle) {
return null;
}
const transmissionModels = await getProductFilters(
- { collection: collectionHandle, make },
+ { collection: collectionHandle },
MODEL_FILTER_ID
);
@@ -40,7 +34,7 @@ const Models = async ({
{transmissionModels.values.map((model) => (
{model.label}
diff --git a/components/transmission-codes/index.tsx b/components/transmission-codes/index.tsx
index cd21f56fe..53218e20f 100644
--- a/components/transmission-codes/index.tsx
+++ b/components/transmission-codes/index.tsx
@@ -1,19 +1,13 @@
import { StarIcon } from '@heroicons/react/24/outline';
import Tag from 'components/tag';
-import { MAKE_FILTER_ID, TRANSMISSION_CODE_FILTER_ID } from 'lib/constants';
+import { TRANSMISSION_CODE_FILTER_ID } from 'lib/constants';
import { getProductFilters } from 'lib/shopify';
import { getCollectionUrl } from 'lib/utils';
import Link from 'next/link';
-const TransmissionCode = async ({
- collectionHandle,
- make
-}: {
- collectionHandle: string;
- make?: string | string[];
-}) => {
+const TransmissionCode = async ({ collectionHandle }: { collectionHandle: string }) => {
const transmissionCodes = await getProductFilters(
- { collection: collectionHandle, make },
+ { collection: collectionHandle },
TRANSMISSION_CODE_FILTER_ID
);
@@ -34,7 +28,7 @@ const TransmissionCode = async ({
{transmissionCodes.values.map((transmissionCode) => (
diff --git a/lib/shopify/index.ts b/lib/shopify/index.ts
index 65a0b9a58..df922c2a5 100644
--- a/lib/shopify/index.ts
+++ b/lib/shopify/index.ts
@@ -1181,24 +1181,14 @@ export const getFile = async (id: string) => {
};
export async function getProductFilters(
- { collection, make }: { collection: string; make?: string | string[] },
+ { collection }: { collection: string },
filterId: string
): Promise {
- const [namespace, metafieldKey] = MAKE_FILTER_ID.split('.').slice(-2);
- const _make = Array.isArray(make) ? make : make ? [make] : undefined;
-
const res = await shopifyFetch({
query: getProductFiltersQuery,
tags: [TAGS.collections, TAGS.products],
variables: {
- handle: collection,
- ...(_make
- ? {
- filters: _make.map((make) => ({
- productMetafield: { namespace, key: metafieldKey, value: make }
- }))
- }
- : {})
+ handle: collection
}
});