How Expire Links Automatically

Increasing your prices? Maybe you’re running a sale and do not want to sit up till midnight to manually edit your pages to switch out old order links. Some shopping carts have the ability to do that automatically but many also don’t.

You can easily work around that with just a little bit of basic copy and paste PHP code. There are a few ways to approach it. One method is to simply swap out the links or button. Although it is used for a banner in that example, it can just as easily be used for order buttons and order links.

Today, I’ll give you a rough outline of a different method. This method is actually a re-direct. So here’s how it works.

You first create a .php file. You can name it anything. In this example we’ll use order.php. In that file, you will see code like the following.

Now you add simple coding to redirect based on the expiry date

On your sales page, instead of linking to the checkout URL, link to order.php

That’s all. Now, every time order.php is loaded, the server will figure up today’s date, compare it to your expiry date and redirect people accordingly. Pretty simple, easy peasy.

A few things you have to know about time functions. The time the code will execute will depend on what time zone your server is set to. So if it goes off earlier or later than expected, there’s a good chance your server is set to a different time zone.

Also, this method does not prevent people from bookmarking your checkout URL. So it is still a good idea overall to disable that URL later if possible.

Photo by aussiegall

Do You Want A Hands-Free Business?

Then get this guide to help you systemize your business so you'll have more time working on your business.

!
!

Hey! I want to make sure you know what you're getting here. In addition to the guide, you will also receive our memo that includes special offers, announcements and of course actionable information.

Terms and Conditions checkbox is required.
Something went wrong. Please check your entries and try again.
Facebook Comments

1 Comments

  1. turnkeytitan on August 29, 2011 at 3:56 am

    Hi Lynette, this is a really nice solution. Does this code show if someone views the page source, or is it obscured?