V
V
vadimv82020-04-30 00:24:33
WordPress
vadimv8, 2020-04-30 00:24:33

How to implement a redirect from the thank you page to a random link from an array?

Prompt or direct in the implementation of this task.
The essence of the solution is that instead of a thank you page (in woocomerce ), I could redirect the client to a random external link.
Now the redirect is implemented in this way, the following code is written in the thankyou.php file: It works without any complaints, but the link must be dynamic, that is, forwarded to pre-specified links using a pre-written method. That is, after placing an order, a person is constantly redirected to pre-defined links. Client 1, after placing an order, follows link #1. The next client after placing an order is sent to the link #2. Accordingly, the 3rd client, upon completion of the order, goes through the 3rd link, the 4th client already goes through the link #1.
wp_redirect("http://www.site.com/", 301);

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2020-04-30
@loonny

Redirect them to a page that will later redirect them to a random link

P
Pychev Anatoly, 2020-04-30
@pton

Here is a direct answer to your question. Quite a bit of magic.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question