latest stable versions: v120514 (changelog)

Offering a Free Coupon Code (100% Discount)

Due to restrictions enforced by PayPal, it's not currently possible to create an s2Member Pro Form Coupon Code for a 100% discount because PayPal requires the checkout to total at least $0.01.

To get around this, you can use an s2Member Free Registration Form (s2Member Pro required) to allow your visitors to register without paying.

You can generate a Free Registration Form from WP Admin -> s2Member -> PayPal Pro Forms -> PayPal Pro / Free Registration Forms

Restricting Access to the Free Registration Form

To help prevent unauthorized access to the Free Registration Form, you have a few options.

  1. Use a voucher/coupon code in the URL and check to see if the code is present and valid before displaying the Free Registration Form.
  2. Create a custom HTML form that accepts a voucher/coupon code and then write custom PHP code to check the code against a known-list of codes, only providing access to the form if the code is valid.

While the second option provides more flexibility and helps prevent the sharing/reuse of the code, it requires more custom programming. In this article, I will explain how to accomplish the easier of the two methods: Using a voucher/coupon code in the page URL and displaying the Free Registration Form if the code is present.

For example, if your purchase page is located at http://example.com/purchase/, then visitors will need to use http://example.com/purchase/?voucher=free to display the Free Registration Form. (You can change free to anything you like in the PHP code that you add to the page; see below.)

Verifying the Voucher/Coupon Code using PHP

Note: The following instructions require that you install and activate the Exec-PHP Plugin.
Use the following PHP code on your purchase page to check if the page URL contains the voucher/coupon code. If the URL contains the correct code, the Free Registration Form will be displayed. Otherwise, the normal payment form will be displayed.
<?php if (isset($_GET['voucher']) && $_GET['voucher'] == 'free') { ?>
	Show the free registration form.
<?php } else { ?>
	Show the payment form.
<?php } ?>

About the Author

Raam (Support Rep)Raam is an explorer who seeks the adventure and wisdom of experience. He shares knowledge and ideas with great respect for individual potential and holds high regard for the legacy of humanity. Raam travels the world as a nomad and lives with what fits on his back. You may catch him crafting words in a cafe, hiking barefoot in a forest, or lost deep in thought wondering what it all means.View all posts by Raam (Support Rep) →

If you are a customer, please use our Customer Support Forums for priority support. We also have Community Forums available to all site owners (no purchase required). You can register here (it's free). For further details, please read our Support Policy.