commerce

package
v1.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 36 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package commerce is the eCommerce edition: the blog module list plus the catalog module — native pricing, variant matrices, stock, and SKUs keyed to a configured product post type — and the official storefront theme in place of the blog theme. Install path:

go install github.com/aristorinjuang/lesstruct/cmd/lesstruct-ecommerce@latest

Operators may still override any page or asset with THEME_DIR. The demo project's config.toml works unchanged.

Orders wiring: the three seam adapters the orders module needs. The cart service feeds checkout, the content service snapshots published titles, and the platform email service carries the customer notifications. The wire step lives with the state in commerce.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Edition

func Edition() app.Edition

Edition returns the commerce edition: the full blog composition plus the catalog, cart, and orders modules, with the storefront theme registered in place of the default blog theme. The blog hooks run first (their modules adopt the platform services), then the catalog wire adds the commerce stack and accumulates its config extras, the cart wire adds the token-keyed carts priced from the catalog service, and the orders wire adds checkout over the cart plus the admin order surface. The merged config extras install once after every wire ran.

func NewCartCheckout

func NewCartCheckout(service *cartdomain.Service) ordersdomain.CartSource

NewCartCheckout builds the seam adapter over the adopted cart service.

func NewCatalogInventory

func NewCatalogInventory(service *catalogdomain.Service, log kernel.Logger) ordersdomain.Inventory

NewCatalogInventory builds the seam adapter over the adopted catalog service.

func NewCatalogMailer

func NewCatalogMailer(service *email.Service, notifyEmail string) catalogdomain.Mailer

NewCatalogMailer builds the Mailer seam adapter over the platform email service and the [catalog] notify_email recipient (empty disables).

func NewCatalogSource

func NewCatalogSource(service *catalogdomain.Service, identity ProductIdentityFunc) cartdomain.CatalogSource

NewCatalogSource builds the seam adapter over the adopted catalog service. The identity lookup may be nil, in which case lines carry no display labels.

func NewContentTitles

func NewContentTitles(service *contentdomain.Service) ordersdomain.ContentSource

NewContentTitles builds the seam adapter over the platform content service.

func NewOrderMailer

func NewOrderMailer(service *email.Service, payee email.ManualPayee) ordersdomain.Mailer

NewOrderMailer builds the seam adapter over the platform email service. A set payee appends the How-to-pay block to the confirmation email.

func NewOrderSeams

func NewOrderSeams(service *ordersdomain.Service) paymentsdomain.Orders

NewOrderSeams builds the Orders seam adapter over the adopted orders service.

func NewPaymentMailer

func NewPaymentMailer(service *email.Service) paymentsdomain.Mailer

NewPaymentMailer builds the Mailer seam adapter over the platform email service.

Types

type ProductIdentity

type ProductIdentity struct {
	Title    string
	Slug     string
	ImageURL string
}

ProductIdentity is the published display identity of one product: what the cart page needs to render a recognizable line.

type ProductIdentityFunc

type ProductIdentityFunc func(ctx context.Context, contentID int) (ProductIdentity, bool)

ProductIdentityFunc resolves a published product's display identity. A miss returns ok=false: the line still resolves, just without labels.

func NewProductIdentity

func NewProductIdentity(service *contentdomain.Service) ProductIdentityFunc

NewProductIdentity adapts the content service onto ProductIdentityFunc. The image is the explicit featured image, falling back to the first image in the body — the same resolution the public content pages use, so cart lines match the storefront cards.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL