Placing Live Test Orders With Shopify Plus

March 29, 2019
By Devan Hurst,
eCommerce Software Developer

When you need to place a test order, it’s as easy as turning on Test Payments! But, what if your site is live? 

You can’t turn on Test Payments if you have customers on your site! Getting out a real credit card, going through all the steps, and actually placing an order can be a pain, especially if you want to conduct multiple test orders. The goods news — with Shopify Plus you can enable quick test orders that only admins can see.

Why Place Test Orders?

Test orders are an important component of running an eCommerce site. When you place test orders it allows you to make sure your checkout process and settings for order processing, inventory, shipping, email, notification, and taxes are all working properly. Test orders allow you to place yourself in your customer’s shoes and identify bumps in the road your shopper may encounter on the way to completing a purchase. 

You want to be absolutely sure that your analytics data and conversion tracking pixels are implemented correctly. Unfortunately, on a live Shopify site, there’s really only one way you can get to the confirmation page to test it, and that’s with a live transaction. This tutorial sets out to make that testing process painless, and hopefully teach you a thing or two about Shopify Scripts along the way!

Let ’s walk through how you can run and place live test orders using Shopify Plus. We recommend having your Shopify Plus account pulled up for the simplest follow along set-up.

Step One: Tag Yourself

The first step is to make sure you have the account setup correctly. You’ll need a way to differentiate admins from regular customers. We recommend using a customer tag. 

For the purposes of this tutorial, we’ll call it “test account” (case-sensitive!). Go and tag your own customer account with that tag.

screen grab of step one

Step Two: Create a Payment Script

Next, you will need to create a payment script. First, install Script Editor and open it up.

screen grab of script editor install

Create a script, select the Payment Gateways tab, and select Blank template. Name it something descriptive like “Test Gateway for Developers.”

screen grab of how to create script

Insert the following code:

if !Input.cart.customer || !Input.cart.customer.tags.include?("test account")

  Input.payment_gateways.delete_if do |payment_gateway|

    payment_gateway.name == "Test"

  end

end

Output.payment_gateways = Input.payment_gateways

In the checkout, this script will remove the payment gateway named “Test” for any user that does not have the customer tag ‘test account’. Publish this code and leave the tab open so you can test the script in a couple of minutes. We can’t hide a “Test” gateway if it doesn’t exist, so let’s make it!

Step Three: Create a Payment Method

Head to Settings > Payments > Manual Payments > Create Custom Payment Method, and create a new payment method; we recommend naming it  “Test.” This method behaves like a COD or bank deposit. In other words, it does nothing and requires invoicing the customer after their purchase. Don’t forget to save the payment method!

screen grab of step three creating a payment method

Step Four: Test It!

After completing that last step, your payment method is now live! You will want to check on your live site and make sure your customers can’t see the payment method as an option. 

Go back to the script editor and click Run Script. The Output section should not contain your test method.

Next, add your tagged customer to the cart in the Input tab. Try running the script again. The Output should contain your test method!

screen grab of successful and unsucessful resutls

Quick note: As with all testing, including all of the Google Analytics eCommerce features that your site may be using, you can only find bugs in the parts of your implementation that you actually test. And eCommerce tracking is more complicated, so it’s harder to get all the details right. It helps to have a testing plan, so you can guarantee you aren’t missing any features or edge cases. If you’re curious, check out this outline for a great way to test your Enhanced eCommerce plan (it includes a free test template!).

Step Five: Celebrate!

If your tests aren’t looking right, go deactivate your new payment method and review the steps again. Chances are there’s an error in the casing of your tag or payment method; the code is case sensitive!

However, if your tests were successful, you’re all done! You now have a hidden payment method and don’t have to use a live credit card to make test orders.

giphy.gif

Conclusion

It’s not rocket science. A seamless, simple, and easy ordering system is essential for converting potential shoppers. Placing test orders helps ensure your system is running as intended and helps identify possible headaches for your shoppers. Using the above steps you will be able to flawlessly execute test orders to your heart's content and make your customers' lives easier in the process!