One of the things that makes PHPurchase so flexible is that virtually all aspects of your store and it’s layout are managed through shortcodes. If you are not yet familiar with WordPress and using shortcodes, they are just snippets of code that you can insert into your posts and pages to execute various functions. PHPurchase provides the following shortcodes.
Add To Cart Button
[cart-button item="EX-29"]
This is the basic syntax for displaying an add to cart button, which when clicked, will add the procuct with the specified item number to the customer’s shopping cart.
This shortcode supports the following optional attributes:
style: CSS style information to be applied to the add to cart button
showprice: Either yes or no enabling you to show or hide the price associated with the product.
img: The URL to the image to be used for the add to cart button. This lets you specify any image you want to use for the add to cart button.
An example of using the cart-button shortcode with all of the optional attributes would look like this:
[cart-button item="EX-29" style="padding: 5px; float: right;" showprice="no" img="http://www.site.com/path/to/img.jpg"]
The Shopping Cart
[cart]
The shopping cart listing all of the products the customer has added to their cart can be displayed on any page allowing you to customize your checkout process however you like. For example, you could include the shopping cart and the checkout form (short code below) on the same page to create a one page checkout process for your store.
The cart shortcode supports the following optional attributes:
mode: read – this puts the shopping cart in read-only mode which displays the products and their quantities in the shopping cart but does not let the user modify the contents of the cart. This is a good way to display the shopping cart on the checkout page so that your customer can see exactly what they are buying.
tax: The amount of tax you will be charging the customer. Usually tax is charged during the checkout process because the buyer’s location is not known. In the case of PayPal Express Checkout, however, you will know the buyer’s location when they return to your website after having logged into PayPal. So, PHPurchase will display the amount of tax that is goingn to be charged to the order in the shopping cart view. The Express Checkout page that PHPurhcase uses is already setup to show the tax, you don’t have to do anything. It is very rare that you will ever need to customize your site with the tax attribute, but it is there if you need it.
An example of using the cart shortcode with the optional mode attribute looks like this:
[cart mode="read"]
PayPal Website Payments Pro
[paypalprocheckout]
PHPurchase is integrated with PayPal Website Payments Pro which requires a PayPal Website Payments Pro account. This will allow you to use PayPal as a credit card processing agent, letting your customers pay with their credit card without ever leaving your website.
Please note that if you use PayPal Website Payments Pro, PayPal also requires that you include PayPal Express Checkout as well. To do so, navigate to your store/checkout page and included the following two shortcodes:
[express] [paypalprocheckout]
PayPal Express Checkout
[expresscheckout]
PayPal Express Checkout supports the following optional attribute:
style: CSS style information to be applied to the Express Checkout form.
This is a very popular shortcode and very useful. You can put a Check Out With PayPal button anywhere on your site to allow your customers to checkout with PayPal Express Checkout. Using PayPal Express Checkout let’s you keep control of the checkout process while letting your buyers pay with PayPal. This is a great way to sell digital products.
You can specify CSS styles to your express checkout button which gives you powerful control over where and how your Express Checkout button is displayed. For example, you may want to float the button to the right.
[express style="padding-right: 20px; float: right;"] [paypalprocheckout]
PayPal Website Payments Standard
[paypalcheckout]
PayPal Website Payments Standard supports the following optional attribute:
style: CSS style information to be applied to the Express Checkout form.
PayPal website payments standard is a simple and easy way to start selling products on your website. You can put a Checkout With PayPal button anywhere on your site. For example, you may want to configure your store/checkout page with the cart short code and the paypalcheckout shortcode. To do so, navigate to the store/checkout page that was created for you when you installed PHPurchase and enter the following two shortcodes:
[cart mode="read"] [paypalcheckout]
Note: Make sure there is at least a space between your two shortcodes. WordPress will get confused if you put two shortcodes back to back without at least a space or a line break between them.
The paypalcheckout shortcode accepts an optional style attribute so that you can provide CSS styles to the checkout with paypal button. For example you might want to float the button to the right, which you can do as follows:
[paypalcheckout style=”float: right;”]
Authorize.net or Quantum Gateway Credit Card Checkout Form
[authcheckout]
PHPurchase can be used with any payment gateway that implements the Authorize.net API. Of course, this includes Authorize.net but it also includes that Quantum Gateway which we recommend over Authorize.net because it offers more features, better functionality, and a much lower price. Whichever payment gateway you choose, you can display the checkout form using the authcheckout shortcode.
Also note that you can use BOTH the authcheckout shortcode AND the paypalcheckout on the same page providing multiple payment options for your customers. For example, a checkout page that offers both PayPal and Credit Card payments could include three short codes. Navigate to the store/checkout page which was created for you when you installed PHPurchase and enter the following three shortcodes:
[cart mode="read"] [paypalcheckout style="padding-right: 20px; float: right;"] [authcheckout]
The Receipt
[receipt]
This is the shortcode to display the customers receipt, you probably won’t use this shortcode often because it is automatically installed for you on the store/receipt page when you install PHPurchase. To customize the receipt page, the best thing to do is navigate to your store/receipt page in your WordPress admin panel and configure the page however you see fit. Include a thank you message, instructions, etc. Then put the receipt short code at the bottom of the page.
Instant Payment Notification
[ipn]
PHPurchase integrates with PayPal Website Payments Standard and is alerted to sales processed through PayPal via PayPal’s Instant Payment Notification system. When you install PHPurchase the store/ipn page is created for you and includes the ipn short code. You should probably never have to modify this page. When you are configuring your PayPal account you should provide the URL to your store/ipn page to PayPal so that PayPal can save the sale to your PHPurchase order management system.
You do not have to use PayPal’s Instant Payment Notification system, but if you do not, then PHPurchase will not know about the sales that are processed through PayPal. This may not be a problem as PayPal will send receipt emails to you and your customer and you don’t have to use the PHPurchase order management panel if you don’t want to.
Manually Adding Shopping Cart Sidebar
You can put the shopping cart sidebar widget anywhere on your WordPress site including in the header, the footer, any page or post, and you can manually add it to the sidebar. To include the shopping cart widget manually in your page or post content simply use the shortcode:
[shoppingcart]
If you want to include the shopping cart widget anywhere other than in your page or post content, such as if you want to manually place the shopping cart widget in your sidebar or if you want to include the shopping cart code in your theme’s header, you need to use the PHP code snippet: