Files
payloadcms/test/plugin-ecommerce/app/(shop)/shop/page.tsx
Paul ef4874b9a0 feat: ecommerce plugin and template (#8297)
This PR adds an ecommerce plugin package with both a Payload plugin and
React UI utilities for the frontend. It also adds a new ecommerce
template and new ecommerce test suite.

It also makes a change to the `cpa` package to accept a `--version` flag
to install a specific version of Payload defaulting to the latest.
2025-09-29 20:05:16 -04:00

46 lines
1.1 KiB
TypeScript

import configPromise, { currenciesConfig } from '@payload-config'
import { Cart } from '@/components/Cart.js'
import { getPayload } from 'payload'
import React from 'react'
import { Product } from '@/components/Product.js'
import { CurrencySelector } from '@/components/CurrencySelector.js'
import { Payments } from '@/components/Payments.js'
export const Page = async () => {
const payload = await getPayload({
config: configPromise,
})
const products = await payload.find({
collection: 'products',
depth: 2,
limit: 10,
})
return (
<div>
<h1>Shop Page - {payload?.config?.collections?.length} collections</h1>
{products?.docs?.length > 0 ? (
<ul>
{products.docs.map((product) => (
<li key={product.id}>
<Product product={product} />
</li>
))}
</ul>
) : (
<p>No products found.</p>
)}
<Cart />
<CurrencySelector currenciesConfig={currenciesConfig} />
<Payments currenciesConfig={currenciesConfig} />
</div>
)
}
export default Page