=== DimDul One Page Product Checkout for WooCommerce ===
Contributors: dimdulltd
Tags: woocommerce, checkout, landing page, one page checkout, sales funnel
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
WC requires at least: 7.0
WC tested up to: 11.0
Stable tag: 1.1.5
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn any WooCommerce product into a one-page checkout with product, cart, and payment on a single landing page.

== Description ==

**DimDul One Page Product Checkout for WooCommerce** is a one-page checkout plugin for WooCommerce stores. It places the product, quantity controls, and checkout form on one landing page so a shopper can choose options and pay without visiting a separate cart or checkout URL.

A WooCommerce one-page product checkout is a dedicated page for a single SKU. The product, add-to-cart step, and payment form share the same permalink. That is the layout this plugin builds with one shortcode.

= Why use a one-page product checkout =

Standard WooCommerce sends people through catalog → product → cart → checkout. Each extra page is a place to leave, especially on phones and paid traffic.

A one-page product landing keeps the offer and the order form together:

* **Fewer steps to pay.** The shopper does not hunt for Cart or Checkout after adding the product.
* **One URL for campaigns.** Ads, email, and social posts can point at a single product checkout page instead of a catalog.
* **Focus on one SKU.** Optional cart-clear keeps the page selling the featured product, not leftover items.
* **Options stay on the page.** Variable products keep WooCommerce’s native form, including variation swatches.
* **Layout matches the offer.** Five templates cover compact funnels, long-form sales pages, and sticky checkout beside product details.
* **Reuse one pattern.** Duplicate the page, change `product_id`, and publish another product checkout URL.

= Who it is for =

* Store owners running ads to a single product
* Direct-response and sales-funnel pages that skip the shop
* Simple or variable products that need options, quantity, and payment on one screen
* Teams publishing many product landers from the same shortcode

It is not a replacement for a multi-product catalog or cart. Grouped, bundled, and external/affiliate products are not supported.

= One-page checkout vs standard WooCommerce checkout =

* **Standard checkout** — Shoppers browse, add items, open the cart, then pay on the checkout page. Best when people compare several products.
* **One-page product checkout** — One product, one landing URL, checkout on the same page. Best when traffic already chose the SKU (ads, email, influencer links, landing-page funnels).

Your shop, cart, and checkout pages keep working. This plugin adds an optional lander; it does not remove the default WooCommerce flow.

= Features =

* Shortcode: `[one_page_product_checkout product_id="123"]`
* Five templates: Classic, Stacked, Detail First, Express, Sticky Sidebar
* Per-page `template="…"` override; site-wide default in settings
* Optional long **Description** and **Reviews** (display only)
* AJAX add-to-cart and live quantity updates
* Simple and variable products, including Variation Swatches for WooCommerce
* Server-side variation matching and stock checks
* Cart-merge so the same line is updated instead of duplicated
* Optional cart-clear and auto-add for simple products
* Accent colours, button text, and checkout heading in settings
* WooCommerce HPOS compatible; translation ready

= Shortcode =

Place on any page. Replace `123` with the product ID (**Products** → hover or edit; the ID is `post=123` in the URL).

    [one_page_product_checkout product_id="123"]

Omitted attributes use **WooCommerce → One Page Checkout**.

**Required**

* `product_id` (integer) — Published **simple** or **variable** product ID.

**Optional**

Boolean attributes accept `yes` / `no`, plus `true` / `1` / `on` and `false` / `0` / `off`.

* `template` — `classic` | `stacked` | `detail-first` | `express` | `sidebar`. Default: settings (`classic`). Legacy: `two-column` → `classic`, `single` → `stacked`.
* `clear_cart` — Empty the cart before render. Default: `no`. Use `yes` on dedicated funnels.
* `auto_add_simple` — Simple products only: add qty `1` on first load if not in cart. Default: `yes`.
* `show_product_summary` — Show image, title, price, and short description. Default: `yes`.

    [one_page_product_checkout product_id="123" template="sidebar" clear_cart="yes" auto_add_simple="yes" show_product_summary="yes"]

Ad landing (this SKU only, compact):

    [one_page_product_checkout product_id="456" clear_cart="yes" template="express"]

Variable product with details and sticky checkout:

    [one_page_product_checkout product_id="789" template="sidebar"]

Simple product; shopper chooses quantity first:

    [one_page_product_checkout product_id="321" auto_add_simple="no"]

= Landing templates =

* `classic` (default) — Two columns: product summary beside purchase and checkout.
* `stacked` — Single column: summary, purchase, checkout, description, reviews.
* `detail-first` — Summary and purchase on top, then description, reviews, checkout.
* `express` — Narrow funnel: summary, purchase, and checkout only.
* `sidebar` — Scrolling details with a sticky checkout card on desktop.

Use **Express** for short paid-traffic landers, **Classic** for a side-by-side offer, **Stacked** or **Detail First** when copy and reviews belong in the flow, and **Sticky Sidebar** when checkout should stay visible while the shopper reads.

= Product landing pages at scale =

The shortcode is the template; `product_id` is unique per page. Duplicate a page, change only the product ID, and give each URL its own title and slug. Point each campaign at that permalink. Use `clear_cart="yes"` when the page must sell only that SKU.

== Installation ==

1. Upload `dimdul-one-page-product-checkout` to `/wp-content/plugins/`, or install the ZIP via **Plugins → Add New → Upload Plugin**.
2. Activate the plugin.
3. Activate [WooCommerce](https://wordpress.org/plugins/woocommerce/).
4. Open **WooCommerce → One Page Checkout** and set defaults.
5. Add `[one_page_product_checkout product_id="123"]` to a page, replacing `123` with a real product ID.
6. View the page and complete a test order.

== Frequently Asked Questions ==

= What is a one-page product checkout for WooCommerce? =

It is a landing page that shows one product and the checkout form on the same URL. The shopper does not open a separate cart or checkout page. DimDul One Page Product Checkout builds that layout with `[one_page_product_checkout]`.

= Why put checkout on the product landing page? =

Paid ads and email often send people who already chose a product. Extra cart and checkout steps add friction. A one-page checkout keeps the offer and payment together so the visit can end in an order on the same page.

= How do I add one-page checkout to a WooCommerce product? =

Create a page, paste `[one_page_product_checkout product_id="123"]`, and replace `123` with the product ID. Optionally set `template`, `clear_cart`, `auto_add_simple`, and `show_product_summary`.

= How do I find the product ID? =

**Products** → hover the row or open the editor. The ID is the `post=` number in the URL.

= Does this replace WooCommerce cart and checkout? =

No. Catalog, cart, and checkout keep working. This adds an optional lander for one product. Other cart items remain unless `clear_cart="yes"`.

= Does it work with variable products and variation swatches? =

Yes. It uses WooCommerce’s native variation form, so dropdowns and swatch plugins work as usual.

= Which product types are supported? =

Simple and variable products only.

= Which template should I use? =

**Express** for short funnels, **Classic** for side-by-side product and checkout, **Stacked** or **Detail First** for long copy and reviews, **Sticky Sidebar** (`sidebar`) when checkout should stay on screen.

= Can I create many product checkout pages from one pattern? =

Yes. Reuse the shortcode and change `product_id`. Keep unique titles and slugs. Use `clear_cart="yes"` for single-SKU campaign URLs.

= Where are the settings? =

**WooCommerce → One Page Checkout**. If WooCommerce is inactive, use **Settings → One Page Checkout**.

== Screenshots ==

1. Classic template — product summary beside quantity controls and the embedded WooCommerce checkout.
2. Stacked template — product, purchase controls, and checkout in a single-column landing flow.
3. Detail First template — product details and description with checkout on the same page.
4. Express template — compact centered funnel with product, quantity, and checkout.
5. Sticky Sidebar template — scrolling product details with a sticky checkout card.
6. Admin settings — defaults, landing template picker, accent colours, and button text.

== Changelog ==

= 1.1.5 =
* Tweak: distinctive DimDul plugin name and slug for WordPress.org.
* Tweak: keep "Tested up to" only in the readme.
* Tweak: expanded WordPress.org readme with shortcode parameters, settings, and usage.
* Fix: Plugin URI now points to the public product page on dimdul.com.

= 1.1.4 =
* Tweak: WordPress.org headers, license file, and contributor metadata.
* Tweak: declare WooCommerce as a required plugin.
* Fix: settings remain available under Settings when WooCommerce is inactive.
* Fix: shop managers can save settings (capability matches the WooCommerce menu).
* Fix: uninstall cleanup on multisite no longer relies on an unused activation transient.

= 1.1.3 =
* Fix: settings fields under the template picker keep the normal WordPress label/control layout.

= 1.1.2 =
* Fix: template picker cards no longer stretch into tall empty strips.

= 1.1.1 =
* Tweak: full-width equal-height template picker in settings, with a clearer selected state.

= 1.1.0 =
* New: 5 selectable landing templates (Classic, Stacked, Detail First, Express, Sticky Sidebar).
* New: `template="…"` shortcode attribute and a "Landing template" setting.
* New: optional product Description and Reviews (display only) sections in the richer templates.
* Tweak: the `layout` option is deprecated in favour of `template` and is mapped automatically (two-column → Classic, single → Stacked). Existing sites keep their current look.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 1.1.5 =
WordPress.org naming, metadata, and documentation updates. Shortcode usage is unchanged.

= 1.1.4 =
WordPress.org metadata and settings-capability fixes. No change to shortcode usage.

= 1.1.0 =
Adds selectable templates plus description and reviews sections. Existing layouts are preserved automatically.

= 1.0.0 =
Initial release.
