modify/add shortcode – UserPro Forums https://forum.userproplugin.com/forums/topic/modifyadd-shortcode/feed/ Sun, 19 May 2024 07:06:28 +0000 https://bbpress.org/?v=2.6.2 en-US https://forum.userproplugin.com/forums/topic/modifyadd-shortcode/#post-21000 <![CDATA[modify/add shortcode]]> https://forum.userproplugin.com/forums/topic/modifyadd-shortcode/#post-21000 Thu, 13 Feb 2014 11:37:08 +0000 Nazeem Hi,

I was wondering if it is possible to add a new shortcode or modify a new shortcode.
I am using the WP UserPro plugin for the registration of students. I am using WooCommerce for paying a membership.
So, when the user fills in the registration form, when I press on register, at the end it should add that specific products to the cart. I’ve configured WooCommerce so that when you add a single product, it will redirect to the checkout page immediately.

Now, there are 2 options:
1. using the redirect option from WP UserPro to the add-to-cart url. For example: http://website.com/become-member/?add-to-cart=62, as this will add the product and then redirect again to the checkout page.
2. Put the product id as parameter in a shortcode, and a boolean for telling that it is a membership registration. In the code i can put the appropriate conditions and then programmatically add the product to the cart. And then use the redirect parameter to redirect to the checkout page. For example: http://website.com/checkout

I’ve tried option 1. But the redirect does not always goes well. This is not WP User Pro’s fault, as it redirects good to the page http://website.com/become-member/?add-to-cart=62. But then it not redirects to the checkout page.

So I want to try option 2. However, I couldn’t find a good way to extend the shortcode and put the appropriate checks. Can you help me out?

I hope to hear from you soon.

]]>