Skip to content

Gratis Commerce

Overview

Gratis Commerce is a lightweight store that sells products through Stripe Checkout without a heavy cart, plus an optional enhancement layer for existing WooCommerce shops (product quick view, wishlist, side-by-side compare, and AJAX attribute filtering). Products and orders are managed as native WordPress post types, so there is no separate dashboard to learn.

Managing products and orders

  1. In the WordPress admin sidebar, open Products (the gratis_product post type, shown with a cart icon).
  2. Click Add New to create a product, giving it a title, description, and featured image, then publish it. Products are public at the /products/ archive.
  3. Find Orders in the same Products menu (the gratis_order post type) to review completed purchases.
Gratis Commerce admin screen
Gratis Commerce admin screen

Product fields

Each product stores these meta values (editable via the Custom Fields panel and exposed in the REST API):

  • Price (_price) — the product’s regular price; used to build the Stripe Checkout amount.
  • Sale price (_sale_price) — an optional reduced price.
  • Downloadable (_downloadable) — marks the product as a digital download rather than a shipped item.
  • Download URL (_download_url) — the file delivered for a downloadable product.

Orders

Orders are created automatically when Stripe confirms a payment. The plugin listens for the checkout.session.completed webhook event and records an order with the purchased product ID (_product_id), amount (_amount), customer email (_customer), and the originating Stripe session ID (_stripe_id). Orders are private to the admin and not publicly viewable.

Stripe checkout configuration

Checkout uses your Stripe secret key, stored in the gratis_commerce_stripe_secret option. There is no dedicated settings screen, so set it programmatically or with WP-CLI, for example wp option update gratis_commerce_stripe_secret sk_live_…. Two REST endpoints power the flow:

  • Create checkout sessionPOST /wp-json/gratis-commerce/v1/checkout/<product_id> returns a Stripe Checkout URL to redirect the buyer to.
  • Stripe webhookPOST /wp-json/gratis-commerce/v1/webhook receives payment events and creates the order. Point your Stripe webhook at this URL.

WooCommerce enhancements and shortcodes

When WooCommerce is active, an extra layer adds product quick view, wishlist, compare, and AJAX filtering (if WooCommerce is not installed, a dismissible admin notice explains the requirement). These shortcodes are available:

  • Wishlist — renders the visitor’s saved products as a grid. [gratis_wishlist]
  • Compare — shows a side-by-side comparison of products the visitor selected. [gratis_compare]
  • Product filter — an AJAX attribute filter for product listings. [gratis_product_filter]

Tips

  • For the standalone store, set gratis_commerce_stripe_secret first, then add products with a Price.
  • Register the /wp-json/gratis-commerce/v1/webhook URL in your Stripe dashboard so orders are recorded.
  • Use the [gratis_wishlist], [gratis_compare], and [gratis_product_filter] shortcodes only on a WooCommerce-powered site.
On this page