I have decided to use the Restrict Content Pro WordPress plugin for one of my SaaS products.

It supports several payment gateways & it’s pretty easy to set up & configure.

Pippin made it super easy for people to try it before they buy it by publicly hosting the plugin’s code on github at https://github.com/restrictcontentpro/restrict-content-pro

He made it that way to facilitate developer contributions. Test driving is a side effect.

If you need support you need to buy a license which makes total sense. The support is super helpful (hey Ashley, I am talking about you).

Ok. Back to what I was trying to accomplish. I wanted to use coupon codes but also wanted to show the discount code box conditionally.

When visitors see a discount box they will stop at checkout and start searching for a code. I have done it and it’s tempting to save a few bucks. While they are searching they might get interrupted and totally forget to come back to my site.

I wanted to enable the discount box for people who are on my email list or if I have directed people from a campaign. I can send them a special link that will allow the discount code box to show up normally.

Add this to your current theme's functions.php. Create it if necessary or just an mu-plugin in wp-content/mu-plugins/my_site_custom_rcp.php

[code]
if ( ! isset( $_REQUEST['my_site_show_rcp_discount_box'] ) ) {
add_action( 'wp_print_scripts', 'my_site_hide_discount_code' );
}

/**
* We want to show the discount code only when send a specific parameter exists.
*/
function my_site_hide_discount_code() {
?>
<style>
#rcp_discount_code_wrap { display: none !important; }
</style>
<?php
}
[/code]

Disclaimer: The content in this post is for educational purposes only. Always remember to take a backup before doing any of the suggested steps just to be on the safe side.
Referral Note: When you purchase through a referral link (if any) on this page, we may earn a commission.
If you're feeling thankful, you can buy me a coffee or a beer