Single Page Checkout (SPC) is Add-on for WP-Invoice that makes it easy to create stand-alone checkout forms on your site. That form can contain a list of Predefined Line Items of your choice, or open items (custom amount entry). Other features include processing fee calculation, custom user information capture, multiple items, and more. Processed payments are visible on the WP-Invoice overview screen on the back-end, alongside regular invoices.
The Single Page Checkout form works with the
[wpi_checkout] shortcode. It can be added on any post or page, giving you the ability to create list of Predefined Line Items. The client viewing that page will be able proceed to checkout and buy the products and services of his choice directly from that page.
Single Page Checkout forms can consist of (but are not limited to) Predefined Line Items, which are default products or services than you create once and can use multiple times in SPC lists or invoices. Consider them as your most common products / services for invoicing or Single Page Checkout forms. We will not cover the specifics on Predefined Line Items here, you can see the complete guide on the help page for Predefined Line Items, where you can see examples and understand them better.
To understand the concept of the Single Page Checkout form better, let’s assume, as an example, that you are a logo designer. You are interested in creating a list so that your clients can easily choose from and purchase your corporate branding services, a logo design, a business card design and a stationery design.
For the needs of this example, we will assume that the professional has a fixed price for each item on that list. Single Page Checkout forms have fixed quantities, prices and tax by nature. The logic here is “they see it, they buy it”. To begin creating a Single Page Checkout form, we go to the WP-Invoice Settings page (Invoice → Settings) and click the “Predefined Line Items” tab. Here we can see an interface that easily allows us to create and edit predefined products and services. That interface may include a couple of dummy items (depending on the version of WP-Invoice you have installed. Feel free to keep, delete or edit these items, you can use them on your Single Page Checkout form if you wish. In this example we will assume that the list of items is empty.
Each Predefined Line Item has five input fields for Name, Description, Quantity, Price and Tax. The Description field’s visibility can be toggled with the “Toggle Description” link underneath the Name field. Each item also includes a dynamic label that will show you the total value of that item, calculated by the quantity, price and tax you set.
We will assume a tax of 20% for each of the services listed above, a price of 30 (currency depends on the setting under the Payment tab) and a quantity of one. You can change these values at will. We begin by filling in the first item on our list, so the result should be something like on this image.
Next we click on the “Add Line Item” button and repeat until all four services are on the list. When we are done we click on the “Save All Settings” button. We should have something like this (I have added some text on the descriptions too):
Note: Even if you change the Description, Quantity, Price and Tax fields of a Predefined Line Item, the shortcode you create will not be broken, as long as you keep the Name field the same.
We are almost done! All we have to do now is to create a shortcode for our Single Page Checkout form.
A shortcode is a short piece of text that you can insert in any post or page, that will be replaced by some kind of user interface, form or content.
A shortcode is a WordPress-specific code that lets you do nifty things with very little effort. Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line. Shortcode = shortcut.
A shortcode uses a command (with or without parameters) in square brackets (to make the WordPress installation it is a shortcode and not normal text. The shortcode for the Single Page Checkout form uses both a command and parameters and to be able to show our list on our website, we have to properly form the shortcode. We start with typing the command for Single Page Checkout which is wpi_checkout, enclosed in square brackets, without any spaces.
Next we have to add the attributes for the title of the list, items we want to include on it etc. Take a look at the shortcode cheatsheet below, to understand the various attributes that can be used with the Single Page Checkout shortcode.
Assuming you have read and understood the shortcode attributes, let’s create our shortcode for the four services we have created:
[wpi_checkout item='Corporate Branding,Logo Design,Business Card Design,Stationery Design']
Now let’s add a title so we can figure out who bought what at the backend.
[wpi_checkout item='Corporate Branding,Logo Design,Business Card Design,Stationery Design' title='Design Package']
Let’s assume we have created a page with our Terms and Conditions and it has an ID of 15. We add it to the shortcode:
[wpi_checkout item='Corporate Branding,Logo Design,Business Card Design,Stationery Design' title='Design Package' terms_page_id='15']
Finally, let’s have the users pay with Authorize.Net by force (note that we must have credit card payments enabled and all the gateway settings set on the Payments Settings tab and in the MerchantPlus.com and Authorize.Net Settings area) and add a 5% fee for credit card processing:
[wpi_checkout item='Corporate Branding,Logo Design,Business Card Design,Stationery Design' title='Design Package' terms_page_id='15' gateways=wpi_authorize fee=5]
We are done! All you need to do now is create a new page (or use an existing one) and paste your complete shortcode in it. To see all the advanced options the shortcode gives you, take a look at the cheatsheet on the right.
Note: Attributes that contain words or terms separated by spaces (Predefined Line Item names for example) must be enclosed in single quotes. See examples in this page.