Single Product Checkout Shortcode: [onepaquc_checkout]

The [onepaquc_checkout] shortcode displays an inline WooCommerce checkout form for a specific product. It can also automatically add the product to the cart when the page loads.

Use this shortcode when you want to create a focused checkout page for one product, such as a single-product landing page, course checkout page, digital product funnel, or special offer page.


Basic usage

Add the shortcode to any page, post, shortcode block, or page builder shortcode widget.

[onepaquc_checkout]

This displays the checkout form if the cart already contains a product.

For a more controlled setup, include a product ID:

[onepaquc_checkout product_id="123"]

This lets the page add or display checkout for a specific product.


When to use this shortcode

Use [onepaquc_checkout] when you want checkout focused on a single product.

Best use cases:

  • One-product sales pages
  • Digital product checkout
  • Course or membership checkout
  • Event ticket checkout
  • Consultation or booking product checkout
  • Special offer pages
  • Funnel pages
  • Buy-now checkout pages

Shortcode attributes

AttributeDefaultAccepted valuesDescription
product_idEmptyProduct IDProduct to add/display at checkout
variation_idEmptyVariation IDSpecific variation to add for variable products
qty1NumberQuantity to add to the cart
clear_cartnoyes, noClears the current cart before adding the product
auto_addyesyes, noAutomatically adds the product to the cart when the page loads

Product ID

Use product_id to define which product should be added to the cart or used for checkout.

[onepaquc_checkout product_id="123"]

How to find a product ID

  1. Go to Products → All Products.
  2. Hover over the product name.
  3. Look for the product ID in the row or browser URL.
  4. Copy the ID.
  5. Add it to the shortcode.

Important notes

The product should be:

  • Published
  • Purchasable
  • In stock, unless backorders are allowed
  • Visible enough for WooCommerce to process correctly

Variation ID

Use variation_id when the product is a variable product and you want to add one specific variation.

[onepaquc_checkout product_id="123" variation_id="456"]

When variation ID is needed

Use variation_id when:

  • The product has variations
  • You want to preselect a specific variation
  • Customers should checkout with one fixed option
  • The page is built for one variation-specific offer

How to find a variation ID

  1. Go to Products → All Products.
  2. Edit the variable product.
  3. Open the Variations tab.
  4. Expand the variation.
  5. Find the variation ID.
  6. Add it to the shortcode.

Important notes for variable products

Make sure the selected variation is:

  • Published
  • In stock
  • Purchasable
  • Connected to the correct parent product
  • Fully configured with required attributes

Quantity

Use qty to set the product quantity.

[onepaquc_checkout product_id="123" qty="2"]

If qty is not set, the default quantity is usually 1.

Use cases

Set a fixed quantity when:

  • The offer includes multiple units
  • The product is sold in packs
  • The checkout page is for a bundle-like purchase
  • You want to pre-fill a quantity for customers

Clear cart

Use clear_cart="yes" when you want to empty the customer’s current cart before adding the selected product.

[onepaquc_checkout product_id="123" clear_cart="yes"]

When to use clear cart

Use this option for single-product funnels where the page should only sell one specific product.

Good for:

  • Dedicated landing pages
  • Paid ads traffic
  • One-product campaigns
  • Limited-time offers
  • Product-specific checkout pages

When not to use clear cart

Do not use it if customers should be allowed to keep other items in their cart.

Avoid it for:

  • General store checkout
  • Upsell pages
  • Multi-product shopping flows
  • Pages where customers may already have items in the cart

Auto-add

Use auto_add to control whether the product is automatically added to the cart.

Auto-add enabled

[onepaquc_checkout product_id="123" auto_add="yes"]

When enabled, the product is added to the cart when the page loads.

Auto-add disabled

[onepaquc_checkout product_id="123" auto_add="no"]

When disabled, the shortcode displays checkout behavior without automatically adding the product.

Recommended use

For most single-product checkout pages, use:

[onepaquc_checkout product_id="123" clear_cart="yes" auto_add="yes"]

This creates a focused checkout page where the correct product is added automatically.


Common examples

Simple product checkout

[onepaquc_checkout product_id="123"]

Use this to display checkout for one simple product.


Simple product checkout with clear cart

[onepaquc_checkout product_id="123" clear_cart="yes"]

Use this when the page should only contain this product.


Product checkout with fixed quantity

[onepaquc_checkout product_id="123" qty="2" clear_cart="yes"]

Use this when the offer includes a fixed quantity.


Variable product checkout

[onepaquc_checkout product_id="123" variation_id="456" clear_cart="yes"]

Use this when the page should checkout with a specific product variation.


Checkout form without auto-add

[onepaquc_checkout product_id="123" auto_add="no"]

Use this when you want more control over how the product is added.


Recommended setup for a single-product funnel

For a dedicated one-product sales page, use:

[onepaquc_checkout product_id="123" qty="1" clear_cart="yes" auto_add="yes"]

This setup:

  • Clears unrelated cart items
  • Adds the selected product
  • Displays checkout on the same page
  • Keeps the customer focused on one offer

How it works

When the shortcode page loads, the plugin can:

  1. Check the shortcode attributes.
  2. Clear the cart if clear_cart="yes" is used.
  3. Add the selected product to the cart if auto_add="yes" is used.
  4. Add the selected variation if variation_id is provided.
  5. Set the quantity from the qty value.
  6. Display the WooCommerce checkout form.

The customer can then complete checkout directly from the page.


Important notes

Checkout requires a product in the cart

WooCommerce checkout normally requires at least one product in the cart. If the cart is empty and auto_add is disabled, the checkout form may not appear or may show an empty-cart message.

Use valid product IDs

If the product ID is wrong, unpublished, out of stock, or not purchasable, the checkout may not load correctly.

Test variable products carefully

For variable products, make sure the selected variation ID belongs to the product ID used in the shortcode.

Avoid caching shortcode checkout pages

Pages using [onepaquc_checkout] should not be cached aggressively. Cart and checkout content is dynamic and depends on WooCommerce sessions.

Exclude the page from:

  • Page cache
  • CDN cache
  • Full-page cache
  • Aggressive JavaScript delay settings

Use one checkout form per page

Avoid placing multiple checkout forms on the same page unless you have tested the flow carefully.


Best practices

Use clear cart for focused campaigns

If the page is built for one offer, use clear_cart="yes" so the customer does not accidentally checkout with old cart items.

Keep the page simple

Single-product checkout pages usually convert better when the page has:

  • Clear product name
  • Short benefit summary
  • Trust badges
  • Checkout form
  • Refund/support information
  • Minimal distractions

Use the correct product type

This shortcode is best for simple products and specific variable product variations. For multiple product choices, use [plugincy_one_page_checkout] instead.

Test the full checkout flow

Before publishing the page, test:

  • Product auto-add
  • Cart clearing
  • Quantity
  • Variation selection
  • Shipping calculation
  • Coupon field
  • Payment gateway
  • Order creation
  • Mobile layout

Troubleshooting

Checkout form does not appear

Check:

  • Product ID is correct.
  • Product is published.
  • Product is purchasable.
  • Product is in stock.
  • Cart is not empty.
  • auto_add is enabled if the cart starts empty.
  • WooCommerce checkout page is configured.
  • The page is not cached.

Wrong product appears in checkout

Check:

  • clear_cart="yes" is used if this should be a single-product page.
  • Product ID is correct.
  • Browser/session cart does not already contain another product.
  • Cache is cleared.

Variable product does not add to cart

Check:

  • Variation ID is correct.
  • Variation belongs to the product ID.
  • Variation is in stock.
  • Variation has all required attributes.
  • Product and variation are published.

Quantity is not correct

Check:

  • qty is a valid number.
  • Product purchase limits allow the quantity.
  • Stock quantity is enough.
  • Another plugin is not modifying cart quantity.

Checkout page reloads or behaves strangely

Check:

  • Cache plugin settings.
  • WooCommerce session cookies.
  • JavaScript errors.
  • Payment gateway scripts.
  • Page builder conflicts.
  • Theme checkout overrides.