Pass coupon code in url to automatically apply on Pro Form checkout?

Has anyone tried to pass the coupon code into the url or to a pro form and have it apply automatically. I couldn’t find a lot of information about working with the coupon codes in any real way.

I haven’t tried doing this, but I’d have thought it should be possible.

KB articles on coupon codes can be found here: https://s2member.com/kb/?kb_q=coupon+code

You can pass a s2member coupon code to an s2member pro form by including the coupon code in the s2p-coupon query parameter but the s2member-pro form, or individual option, you are passing the coupon code to must have coupons enabled.

For instance lets say you wanted to send people a link with a discount code for annual memberships and only wanted it to be applied to annual membership then the following shortcode would provide this.

Option #1 and #2 inherit the parent shortcode’s accept_coupons=“0” but options 3& 4 have coupons enabled.

[s2Member-Pro-Stripe-Form rp="2" rt="M" rr="1" accept_coupons="0"]
	[s2Member-Pro-Stripe-Form level="1" desc="Option 1 (£10.00)" ra="10.00" /]
	[s2Member-Pro-Stripe-Form level="2" desc="Option 2 (£20.00)" ra="20.00" /]
	[s2Member-Pro-Stripe-Form level="1" desc="Option 1 Annual (£100.00)" ra="100.00" accept_coupons="1" rp="1" rt="Y" /]
	[s2Member-Pro-Stripe-Form level="2" desc="Option 2 Annual (£200.00)" ra="200.00" accept_coupons="1" rp="1" rt="Y" /]
[/s2Member-Pro-Stripe-Form]

but if we included include the query parameter s2p-option=3 or s2p-option=4 in the URL these would refer to the third or fourth options on the shortcode, which accepts coupon codes. The following links would do this:

https://www.example.org/join/?s2p-option=3&s2p-coupon=XXXXXXXXXXXXXXXXXXXXXX

https://www.example.org/join/?s2p-option=4&s2p-coupon=YYYYYYYYYYYYYYYYYYYYYY

This is posted 8 years after the original post but I hope its useful to others. It should probably be included in the coupon documentation.

1 Like