Support » Plugin: WordPress Native PHP Sessions » pass session variable to thankyou page

  • Resolved blurredj

    (@blurredj)


    Hello.
    I have a session variable that is generated on order submission and when I echo it shows correct value… I can see it in plugin sessions list as well.

    On thankyou page I call session variable $_SESSION[‘quoteno’];
    but it doesn’t pass to page.

    Am I missing something?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hi @blurredj,

    Sorry, but it’s hard to know whether you’re missing something without being able to see the code, test it out, etc.

    One important detail is that you’ll need to call session_start() before you try to set or retrieve session data. Here’s a more comprehensive tutorial on the topic.

    Thread Starter blurredj

    (@blurredj)

    Thanks for replying Daniel… I already have session_start() at beginning of files. The issue seemed to be the woocommerce_thankyou hook. Change to woocommerce_checkout_order_processed and everything is working correctly. Seems that thank you page was generated before variable was saved, therefore using previously saved variable.

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Ah, good find! Glad to hear you were able to figure it out 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘pass session variable to thankyou page’ is closed to new replies.