mirror of
https://github.com/vercel/commerce.git
synced 2025-05-20 16:36:59 +00:00
Merge pull request #2 from medusajs/feat/medusify-repo
feat: medusify repo
This commit is contained in:
commit
396b07c126
@ -1,5 +1,4 @@
|
|||||||
TWITTER_CREATOR="@vercel"
|
TWITTER_CREATOR="@medusajs"
|
||||||
TWITTER_SITE="https://nextjs.org/commerce"
|
TWITTER_SITE="https://medusajs.com/"
|
||||||
SITE_NAME="Next.js Commerce"
|
SITE_NAME="Next.js Commerce x Medusa"
|
||||||
SHOPIFY_STOREFRONT_ACCESS_TOKEN=
|
MEDUSA_BACKEND_API="http://localhost:9000/store"
|
||||||
SHOPIFY_STORE_DOMAIN=
|
|
||||||
|
@ -28,7 +28,7 @@ Learn more about [Medusa’s architecture](https://docs.medusajs.com/development
|
|||||||
|
|
||||||
You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js Commerce. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/concepts/projects/environment-variables) for this, but a `.env` file is all that is necessary.
|
You will need to use the environment variables [defined in `.env.example`](.env.example) to run Next.js Commerce. It's recommended you use [Vercel Environment Variables](https://vercel.com/docs/concepts/projects/environment-variables) for this, but a `.env` file is all that is necessary.
|
||||||
|
|
||||||
> Note: You should not commit your `.env` file or it will expose secrets that will allow others to control your Shopify store.
|
> Note: You should not commit your `.env` file or it will expose secrets.
|
||||||
|
|
||||||
1. Install Vercel CLI: `npm i -g vercel`
|
1. Install Vercel CLI: `npm i -g vercel`
|
||||||
2. Link local instance with Vercel and GitHub accounts (creates `.vercel` directory): `vercel link`
|
2. Link local instance with Vercel and GitHub accounts (creates `.vercel` directory): `vercel link`
|
||||||
|
@ -6,7 +6,7 @@ import { Suspense } from 'react';
|
|||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata = {
|
||||||
description: 'High-performance ecommerce store built with Next.js, Vercel, and Shopify.',
|
description: 'High-performance ecommerce store built with Next.js, Vercel, and Medusa.',
|
||||||
openGraph: {
|
openGraph: {
|
||||||
images: [
|
images: [
|
||||||
{
|
{
|
||||||
|
@ -22,4 +22,3 @@ export const sorting: SortFilterItem[] = [
|
|||||||
|
|
||||||
export const HIDDEN_PRODUCT_TAG = 'nextjs-frontend-hidden';
|
export const HIDDEN_PRODUCT_TAG = 'nextjs-frontend-hidden';
|
||||||
export const DEFAULT_OPTION = 'Default Title';
|
export const DEFAULT_OPTION = 'Default Title';
|
||||||
export const SHOPIFY_GRAPHQL_API_ENDPOINT = '/api/2023-01/graphql.json';
|
|
||||||
|
@ -18,8 +18,7 @@ import {
|
|||||||
SelectedOption
|
SelectedOption
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
// const endpoint = `${process.env.MEDUSA_BACKEND_API!}`;
|
const ENDPOINT = process.env.MEDUSA_BACKEND_API;
|
||||||
const endpoint = `http://localhost:9000/store`;
|
|
||||||
|
|
||||||
export default async function medusaRequest(
|
export default async function medusaRequest(
|
||||||
method: string,
|
method: string,
|
||||||
@ -38,7 +37,7 @@ export default async function medusaRequest(
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await fetch(`${endpoint}/${path}`, options);
|
const result = await fetch(`${ENDPOINT}${path}`, options);
|
||||||
|
|
||||||
const body = await result.json();
|
const body = await result.json();
|
||||||
|
|
||||||
@ -144,9 +143,9 @@ const reshapeLineItem = (lineItem: MedusaLineItem): CartItem => {
|
|||||||
totalAmount: {
|
totalAmount: {
|
||||||
amount: convertToDecimal(
|
amount: convertToDecimal(
|
||||||
lineItem.total,
|
lineItem.total,
|
||||||
lineItem.variant.prices?.[0]?.currency_code
|
lineItem.variant?.prices?.[0]?.currency_code
|
||||||
).toString(),
|
).toString(),
|
||||||
currencyCode: 'EUR'
|
currencyCode: lineItem.variant?.prices?.[0]?.currency_code || 'EUR'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const quantity = lineItem.quantity;
|
const quantity = lineItem.quantity;
|
||||||
|
@ -10,11 +10,6 @@ module.exports = {
|
|||||||
images: {
|
images: {
|
||||||
formats: ['image/avif', 'image/webp'],
|
formats: ['image/avif', 'image/webp'],
|
||||||
remotePatterns: [
|
remotePatterns: [
|
||||||
{
|
|
||||||
protocol: 'https',
|
|
||||||
hostname: 'cdn.shopify.com',
|
|
||||||
pathname: '/s/files/**'
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
protocol: 'https',
|
protocol: 'https',
|
||||||
hostname: 'medusa-public-images.s3.eu-west-1.amazonaws.com',
|
hostname: 'medusa-public-images.s3.eu-west-1.amazonaws.com',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user