View Single Post
  #5  
Old 07-29-2012, 10:24 PM
Tigress Yoga's Avatar
Tigress Yoga Tigress Yoga is offline
Junior Member
 
Join Date: Dec 2011
Posts: 8
Default Where do I put the code in my wordpress site?

Hi Makfruit,

Thank you so much for your detailed reply.

I know very little about coding

Where do I put the code below? I understand I need to put it on the same page that has the ecwid shopping cart now.

Do I put in after that html in the page editor?

I'm using Wordpress

Thank you!


Quote:
Originally Posted by Makfruit View Post
Hello,

In order to redirect your customers from the order confirmation page to a custom one, you should use a special JavaScript code which will use the Ecwid Javascript API for handling the Ecwid 'OnPageLoad' event. The code looks like this:
Code:
<script>
var confirmationPageURL = "http://google.com";

// Add handler for Ecwid's OnPageLoad event
if (
  typeof(Ecwid) == 'object'
  && typeof(Ecwid.OnPageLoad) == 'object'
) {
  Ecwid.OnPageLoad.add(function(page) {
    // Redirect user if needed
    if (
      typeof(page) == 'object'
      && 'ORDER_CONFIRMATION' == page.type
    ) {
      window.location = confirmationPageURL;
    }
  });
}
</script>
The line 'window.location = confirmationPageURL' will be executed (a visitor will be redirected) right after the confirmation page page is loaded. As you can see, a custom page URL is stored in the variable 'confirmationPageURL' (it is set as 'http://google.com' in the beginning of the code). Please put your 'thank you' page's address in there.

Please notice, that the code above should be inserted after the Ecwid integration code on the page where your store is installed.