Testing Purchases in ZenCart Store

As you build the ZenCart store, you will eventually need to test the purchase flow of the eCommerce application.

There are a few different ways to test the purchase cycles depending on what part of the application you are testing.

1. Test with a real purchase.

Testing with a real purchase in a real transaction between two different party is the best way to test. And should be done at least once before you can say that the application is fully functional. If you do not want to pay the product price, you can go into the admin control panel and change the product price to something small such as two cents. But remember to change it back to the correct price after the test.

2. Testing with PayPal Sandbox

Paypal also provide developers with a PayPal Sandbox Environment that mimic the live PayPal site and services. You need to sign up for sandbox access and create email accounts and such.

Generally, I do not use the PayPal Sandbox for ZenCart site creation, because of the extra overhead involved in creating the test scenarios. If you are simple setting up a shop without modification to the payment modules, performing a real test is much preferred than sandbox testing. However, sandbox testing may be needed or become useful if you are performing advanced core modifications to the payment modules or APIs.

3. Testing with COD

If you just need to these the user scenario of going through the various pages of checkout instead of testing money transaction, then you can test with a COD purchase (cash on delivery). In a COD purchase, no money changes hands. However, you will still be able to go through all the pages of the checkout process, process the order in the admin control panel, and receive order confirmation emails. So if you are customizing those aspect of the application, then making a COD purchase will be a convenient way to test. But remember, you still will need to test with a real transaction at some point in the future.

To make a COD purchase for testing, follow these steps...

a. Login to ZenCart Admin control panel.
b. Go to "Modules -> Payment".
c. Click on "COD" and click "Install". Set to "True" and click "update'. This will add "COD" as another payment option in checkout.
d. Create a customer and go through the checkout process. Select Payment option of "COD".
e. Make the purchase putting a note indicating "Do not ship. This is a test only."

Now after you have completed test, remember to put the store back to the way it was by ...

a. Remove the "COD" from the payment option by going to "Modules -> Payment". Select "COD" and click "Remove".
b. Remove the order by going to "Customer -> Orders". Selecting the test order and click "Delete". Checkmark "Restock product quantity" and click "Delete" button.

Please note that whenever you make a real purchase or a COD purchase, an email will be sent to the email addresses defined in "Configuration -> Email options" indicating that a purchase is made. If you don't want the store owner to get those email during your development testing, you can change those email address to your own temporily. But change them back to the way it was after the test, of course.