Files
commerce/models/fixtures/product.go
zeekay 1943f1c093 Hanzo Commerce
Multi-tenant commerce and billing: orders, subscriptions, invoices, plans,
usage metering and a credit ledger. One Go binary. MIT OR Apache-2.0.

Claude-Session: https://claude.ai/code/session_01SAtaDFm8VDiWrhYHNNtxMw
2026-09-23 21:52:16 -07:00

59 lines
1.1 KiB
Go
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package fixtures
import (
"github.com/zap-proto/zip"
"github.com/hanzoai/commerce/models/product"
"github.com/hanzoai/commerce/models/types/currency"
)
var Product = New("product", func(c *zip.Ctx) *product.Product {
// Get namespaced db
db := getNamespaceDb(c)
// Doge shirt
prod := product.New(db)
prod.Slug = "doge-shirt"
prod.GetOrCreate("Slug=", prod.Slug)
prod.Name = "Such T-shirt"
prod.Headline = "wow such shirt much tee"
prod.Description = `wow
      such shirt
much tee
nice shop
 so hip
    so doge
`
prod.Options = []*product.Option{
&product.Option{
Name: "Size",
Values: []string{"Much", "Wow"},
},
}
prod.Price = 2000
prod.Currency = currency.USD
prod.MustPut()
// Sad Keanu shirt
prod = product.New(db)
prod.Slug = "sad-keanu-shirt"
prod.GetOrCreate("Slug=", prod.Slug)
prod.Name = "Sad Keanu T-shirt"
prod.Headline = "Oh Keanu"
prod.Description = "Sad Keanu is sad."
prod.Options = []*product.Option{
&product.Option{
Name: "Size",
Values: []string{"Sadness"},
},
}
prod.Price = 2500
prod.Currency = currency.USD
prod.MustPut()
return prod
})