- Support forum for the Customer Email Verification for WooCommerce.
- This topic has 6 replies, 5 voices, and was last updated 9 months, 3 weeks ago by pablo-pacheco.
-
AuthorPosts
-
April 28, 2022 at 9:26 am #101571TobyGuest
Hi there,
Do you know how I might achieve the following?
- Aim: Have more than one custom redirect URL after a successful email verification.
- Behaviours:
- If a user’s order contains only one product of the type ‘Simple subscription’ or ‘Variable subscription’, redirect them to a custom URL according to that product’s product ID.
- If a user’s order contains more than one subscription product, redirect them to a default URL (the WooCommerce account dashboard in my case).
Please let me know if you require further information. I look forward to hearing from you.
Kind regards,
Toby
April 29, 2022 at 5:32 am #101572ZohaibParticipantHi Toby,
Unfortunately, it is not possible to redirect customers to multiple pages after successful verification.
The redirect on success option is meant to be used to redirect users after successful verification, this can be to the, home page, shop page, or a custom URL such as a thank you page. But it all users will be redirected to the same page.
April 29, 2022 at 5:42 pm #101573TobyGuestHi Zohaib,
That’s okay – a single redirect URL is fine. Thank you for confirming that only one is possible.
Have a good weekend.
Toby
April 30, 2022 at 8:39 pm #101574Hi Toby,
Although this is not possible with the current options from the plugin, this might be possible with some custom code by using the
alg_wc_ev_user_account_activated
hook. For example:add_action( 'alg_wc_ev_user_account_activated', function ( $user_id, $args ) { if ( ! $args['directly'] ) { return; } $redirect_url = ''; $order_id = get_order_from_user_id( $user_id ); if ( 1 === get_product_type_qty_from_order( 'simple-subscription', $order_id ) || 1 === get_product_type_qty_from_order( 'variable-subscription', $order_id ) ) { $redirect_url = 'http://redirect-to-url-1.com'; } elseif ( get_product_type_qty_from_order( 'simple-subscription', $order_id ) > 1 || get_product_type_qty_from_order( 'variable-subscription', $order_id ) > 1 ) { $redirect_url = 'http://redirect-to-url-2.com'; } $redirect_url = add_query_arg( array( 'alg_wc_ev_success_activation_message' => 1 ), $redirect_url ); wp_redirect( $redirect_url ); exit; }, 90, 2 );
Just a note, the
get_order_from_user_id()
andget_product_type_qty_from_order()
functions do not exist. I just added it as an example.May 4, 2022 at 9:07 am #101575TobyGuestHi Pablo,
Thank you for that snippet. I see how that could work.
Best,
Toby
February 9, 2024 at 5:05 am #134728mohamed hishamParticipantHi
for certain reason, after the user click on the verfication link , it direct him again to the cart despite I change the setting to direct the user to home page from
<table class=”form-table”>
<tbody>
<tr valign=”top”>
<th class=”titledesc” scope=”row”><label for=”alg_wc_ev_redirect_to_my_account_on_success”>Redirect on success</label></th>
</tr>
</tbody>
</table>February 14, 2024 at 2:55 pm #135019pablo-pachecoParticipantHi,
In that case, please try to select “Redirect to custom URL” and set the URL right below.
-
AuthorPosts
- You must be logged in to reply to this topic.