Sauter la navigation

[Résolu] Split: Cred WC submission – remove success message from url

This support ticket is created Il y a 5 années et 9 mois. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Marqué : 

Ce sujet contient 12 réponses, a 2 voix.

Dernière mise à jour par Pat Il y a 5 années et 8 mois.

Assisté par: Minesh.

Auteur
Publications
#1220603

Pat

Hi Minesh,

I'm OK with this. Here is the code I have used :

add_action( 'cred_commerce_form_action', 'my_hook', 10, 4 );
function my_hook( $action, $form_id, $post_id, $form_data ) {
$referer = $_SERVER['HTTP_REFERER'];
        wp_redirect( $referer );
        exit();
 
} 

The only issue I have with that is the url I'm getting has all info like : lien caché

I would like to get only the page without te info linked to success message.

Regards
Pat

#1220745

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - what if you explode the $referer variable using / (slash) and grab the URL.

For example:

add_action( 'cred_commerce_form_action', 'my_hook', 10, 4 );
function my_hook( $action, $form_id, $post_id, $form_data ) {
$referer = $_SERVER['HTTP_REFERER'];
$ref = explode("/",$referer );
        wp_redirect( $ref[0]);
        exit();
  
}

- Please adjust the above code if needed.

#1221619

Pat

Hi Minesh,

Just tested it and got the same issue : I'm getting the full url including the success message info in addition (which means that the form is replaced by the success message !

Any idea?
Regards
Pat

#1221644

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Can I've problem URL and access details?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#1222164

Pat

Hi Linesh,

Unfortunately, this is not possible as this site is in production right now and lots of transactions are made every day.
Do you need other things to better identify the issue?
Regards
Pat

#1222321

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - what if you make a copy of your production site and move the copy to the staging test site and send me access details.

I have set the next reply to private which means only you and I have access to it.

#1223056

Pat

Hi Minesh,

Sorry but this is a huge site and it's really difficult to make a copy.
Is there any issue to define the destination page after Cred submission?
The function you proposed was working (same page reload), but the issue was that the additional info from success message was still there.
II need to reload the page where the Cred is inserted without the additional info after success message !

Let me know
Regards
Pat

#1223733

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Is there any issue to define the destination page after Cred submission?
=> Do you mean that after submission you want to redirect to the specific page?

#1225575

Pat

Hi Minesh,

No, what I want is to redirect to the same page BUT without url parameters info.

Example : here is the page where I'm redirected after a Cred submission :
lien caché

What I want is : lien caché

The issue is that when you reload the page with all url parameters, then the success message is displayed. I want to reload the page and display a "fresh" Cred form in order the users to be able to make another submission with the Cred !

Regards
Pat

#1225840

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Can you please try the following code:

add_action( 'cred_commerce_form_action', 'func_custom_redirect', 10, 4 );
function func_custom_redirect( $action, $form_id, $post_id, $form_data ) {
wp_redirect($_SERVER['SCRIPT_URI']);
die();

}

#1231321

Pat

Hi Minesh,

Sorry for my late answer.

I'm not sure this will close my issue. In fact, looking more deeply, I think the issue is linked to this way of doing :
- User select a product thanks to a Cred form (linked to a specific product) and is redirected to the cart. This is the right way to manage currently as 80% have only one item in the cart when they buy on the site.

Now, concerning the other 20%, then are redirected to the cart after the first item bought, and then, some of them are using the backward arrow of the navigator to come back to the page where the Cred form is (in fact, there are several Cred form in the same page).

And then, we come to the issue as the page has not been fully refreshed, when they validate the second product, it appears that (I'm not sure this is the case for 100% but I'm sure it arrives) the product is added to the cart, but the second Cred does not create the related postype (or at least, does not make it publish and thus, does not send the notification).

So perhaps the best way to manage this would be to avoid using backward arrow and to place a specific button in the cart to come back to the page where they were coming from?

Any idea?
Regards
Pat

#1231447

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Well - when you are talking about cart - this belongs to WooCommerce and I think you need a button/link of "Continue shopping". Please check the following URL:
=> lien caché

Or it will be great if you check with WooCommrece support for a possible solution for your case. They will be a better person to contact in this case.

#1242600

Pat

Hi Minesh,
In fact, I used the option of reloading the page after form submission and it's fine for me. The page is reloaded without success message in the url and can be used for another submission.
Thanks for your patience.
Regards
Pat