Browse Source

fix template api

api-template
davey 4 days ago
parent
commit
bfe7eea229
1 changed files with 6 additions and 5 deletions
  1. 6
    5
      API/shopify/storefront/product/getProduct.js

+ 6
- 5
API/shopify/storefront/product/getProduct.js View File

1
 const storefrontClient = require('../storefrontClient');
1
 const storefrontClient = require('../storefrontClient');
2
 
2
 
3
-const customQuery = 'status:active, product_type:snowboard'; // Replace to see custom result
3
+const defaultQuery = 'status:active, product_type:clothing, product_categroy:dresses'; // Replace to see custom result
4
 
4
 
5
-const maxResults = 10; // Replace to change the number of result
5
+const defaultResult = 10; // Replace to change the number of result
6
 
6
 
7
-const sortBy = 'TITLE'; // Replace with CREATED_AT if need to sort by date, current value is for name 
7
+const defaultSortBy = 'TITLE'; // Replace with CREATED_AT if need to sort by date, current value is for name 
8
 
8
 
9
-const getProduct = async (customQuery) => {
9
+const getProduct = async ( maxResults = defaultResult, sortBy = defaultSortBy, customQuery = defaultQuery ) => {
10
     try {
10
     try {
11
  
11
  
12
         const query = `{
12
         const query = `{
53
     }
53
     }
54
 };
54
 };
55
 
55
 
56
-getProduct(customQuery); 
56
+// Example
57
+// getProduct(5, CREATED_AT, 'product_type:clothing'); 

Loading…
Cancel
Save