This project is a Next.js application that integrates with the Shopify GraphQL API and the Collectr API. It allows users to fetch products from a Shopify store, match them with Collectr options, update product prices, and manage product data efficiently.
- Fetch Products: Retrieve products from your Shopify store and display them in a table.
- Update Prices: Update the price of a product and reflect the changes in real-time.
- Match Products: Match Shopify products with Collectr options and save the matches.
- Check API Limits: View the remaining credits for the Collectr API.
- Pagination: Navigate through products with "Next" and "Previous" buttons.
- SKU Cleanup: Automatically remove trailing "A" from SKUs before processing.
nextjs-shopify-app
βββ pages
β βββ index.tsx # Main entry point of the application
β βββ api
β β βββ collectrLimits.ts # API route to fetch Collectr API limits
βββ components
β βββ ProductTable.tsx # Component to display product information in a table
β βββ ReadProductsTable.tsx # Component to display Shopify products
βββ utils
β βββ fetchCollectrProducts.ts # Utility to fetch Collectr products
β βββ supabaseClient.ts # Utility for Supabase database operations
βββ public # Static assets
βββ styles
β βββ globals.css # Global CSS styles
βββ package.json # npm configuration file
βββ tsconfig.json # TypeScript configuration file
βββ next.config.js # Next.js configuration file
βββ README.md # Project documentation
- Node.js (v14 or higher)
- npm or yarn
- Shopify API credentials
- Collectr API credentials
-
Clone the repository:
git clone <repository-url> cd nextjs-shopify-app
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env.local
file in the root directory and add the following:SHOPIFY_API_URL=<your-shopify-api-url> SHOPIFY_ACCESS_TOKEN=<your-shopify-access-token> COLLECTR_API_BASE_URL=<your-collectr-api-base-url> COLLECTR_API_KEY=<your-collectr-api-key>
-
Run the development server:
npm run dev
-
Open the application: Navigate to
http://localhost:3000
in your browser.
-
Fetch Products:
- Click the "Read Products" button to fetch products from your Shopify store.
- Products will be displayed in a table.
-
Update Product Prices:
- Use the "Update Product" button to update the price of a product.
- The updated price will be reflected in the table.
-
Match Products:
- Click the "Match Products" button to match Shopify products with Collectr options.
- Save the matches to the database.
-
Check API Limits:
- Click the "Check Limit" button to view the remaining credits for the Collectr API.
-
Pagination:
- Use the "Next" and "Previous" buttons to navigate through the product list.
- Caching Issue: Ensure that API responses are not cached by adding appropriate headers.
- SKU Cleanup: SKUs ending with "A" are automatically cleaned before processing.
This project is licensed under the MIT License.
For questions or support, please contact kisstudios98@gmail.com.