Ship your e-commerce site in just a few clicks
Spin up a new project, or connect an existing, and explore rollbacks, CI/CD, edge functions, collaborative deploy previews, and more.
export function CartMain({layout, cart}: CartMainProps) {
const linesCount = Boolean(cart?.lines?.nodes?.length || 0);
const withDiscount =
cart &&
Boolean(cart.discountCodes.filter((code) => code.applicable).length);
const className = `cart-main ${withDiscount ? 'with-discount' : ''}`;
return (
<div className={className}>
<CartEmpty hidden={linesCount} layout={layout} />
<CartDetails cart={cart} layout={layout} />
</div>
);
}
const stream = await getChatStream(
{
...appConfig.apiConfig,
user: context.ip,
messages: [{ role: "system", content: prompt }, ...messages],
},
appConfig.OPENAI_API_KEY ?? ""
);
return new Response(stream, {
headers: { "Content-Type": "text/plain" },
});
---
const homepage = await getEntryBySlug("homepage", "index");
const { banner, key_features, service, testimonial } = homepage.data;
---
<Base>
<Banner banner={banner} />
<KeyFeatures key_features={key_features} />
<Service service={service} />
<Testimonial testimonial={testimonial} />
<Cta />
</Base>
import type { Config, Context } from "@netlify/edge-functions";
export default async (request: Request, context: Context) => {
return Response.json({ geo: context.geo });
};
export const config: Config = {
path: "/geolocation",
};