303.473.4400 / Toll Free: 888.772.0777
Select Page

In Magento 2, we're often trying to test out the whole shopping cart process while we make changes to the system.

I've come up with a way to bypass the payment gateway with a 100% off coupon, Free shipping and a Zero Subtotal checkout option. In this way, you you can make sure the rest of the process works.

Without doing this, the challenge is that in order to place a live order on a site, you often need a live credit card to test out the process. Unfortunately, placing a ton of orders on a live Magento 2 Website with a personal credit card is a great way to get your credit card flagged for fraud. (I've had a lot of credit cards become useless after doing extensive testing.) And even if you do manage to get your order through, the merchant will have to issue a lot of refunds – which can cost them money each time.

Instead, I like to use a process in Magento 2 that uses a combination of a 100% Off Shopping Cart Price Rule, Free Shipping and a Zero Subtotal Checkout option. This will allow you to test out all of the functionality, but bypass payment methods and shipping. (You should also test without this to make sure that shipping quotes work and your payment process works properly, however.)

You could enable the "Check / Money Order" option on the site, but the drawback to that is that allows real customers to select this option. And we've found that it often will be left on after a push to a live site.

Note: this should be used only for testing out your Magento 2 site. Please delete the coupon after you're done testing. Done improperly, you may give away a lot of product for free.

Here's how it works for Magento 2:

Step 1: Create a Cart Price Rule in Magento 2

From your admin area, go to the Marketing –> Promotions –> Cart Price Rules area:

Magento 2 – How to create a Cart Price Rule from Admin

Step 2: Create a 100% off coupon in Magento 2:

First, click on:

Add New Rule – Magento 2

On the next page, you'll enter in information to create your 100% off coupon:

Magento 2 – Create 100% off coupon code

You'll want to give the rule a name (so you remember it) as well as a description. Make sure that the rule is active, and that your Websites and Customer Groups are selected.

On the same page, but below, you'll want to select "Specific Coupon" for the coupon, and give it a super secret code.

Make this hard to guess – because if a real user enters this onto your site, they're going to get free products. In here, I've put in the super-secure "test100" coupon code. But make your code harder to guess!

Create 100% off coupon code for testing in Magento 2

You'll want to set limits on how many times the coupon can be used on the Magento 2 site. I have this set for 99 users per coupon and 99 uses per customer, but you can further restrict this.

And if you really want to make sure that end customers won't be able to use this, set a From and To Date, so that this 100% off coupon expires in the future from the Magento 2 site.

I like to set the priority as 1, so that it supersedes all other coupons.

Finally, make sure that you have the coupon set to "No" for the Public RSS feed for the site. Again, you don't want end users for the Magento 2 site to be able to place free orders. This is strictly for your internal testing.

Step 3: Set Conditions for the Magento 2 Shopping Cart Price Rule

On the next tab down, you can leave this blank to allow you to apply this rule to ALL products in the system.

Setting Conditions for Magento 2 shopping cart price rule

Or, you can further restrict the test coupon code to only apply to a specific product or category. (This limits the risk of people placing orders for free stuff on the Magento 2 site if you make a mistake or someone guesses your super-secret coupon code.)

Step 4: Set the Coupon Code Discount on the Magento 2 Site:

Setting up the coupon code discount on the Magento 2 site

For this step, I recommend using the following settings:

  • Apply: Percent of product price discount. This setting allows you to discount the price by x%.

  • Discount Amount: 100. This discounts the cart by 100%

  • Maximum Qty Discount is Applied to: 0. Leave this at zero for testing purposes.

  • Discount Qty Step (Buy X). Leave this blank for testing.

  • Apply to Shipping Amount. YES. Select Yes, so that your shipping costs are also free / no charge.

  • Discard subsequent rules: NO. Select No, as you don't want to break other rules in the system.

  • Free Shipping. For shipment with matching items. This allows you to have free shipping for the entire cart.

Once this is done, press save.

You're all set! Now, on your cart page, simply add in your coupon code, and you'll be able to test the checkout process without a credit card.

Step 5: Test it out:

First, find a product on the site. In this case, I've created a test product with a price of $100, and I've set up a $5 flat rate shipping method for the site:

Magento 2 – Test product

Next, add it to the cart, and then test out your super secret discount code:

Magento 2 Shopping Cart Page

Once the coupon has been applied, then you'll see that the order total goes to Zero:

Magento 2 – Shopping Cart Page with Coupon code applied.

Click "Proceed to Checkout":

Magento 2 – Proceed to Checkout Page

Magento 2 has a much more streamlined checkout process than the Magento 1.x platform.

Once your information is in the screen, click "Place Order":

Final Place Order Button on Magento 2 site

You can see that this is the first order ever placed on this test site (order #00000001):

Luma – Order Success Page for Magento 2

And finally, here's my confirmation email, letting me know that the order went through:

Magento 2 – Default Confirmation email for placing orders


What this process will allow you to do is test out the ordering process, but not have to worry about having to use a credit card to test out the entire process. This method for testing the ordering process uses a combination of a 100% off coupon, free shipping, and a zero dollar checkout option.

Questions about Magento 2? Call 303.473.4400 or visit here to have a real person contact you now >>

Pin It on Pinterest

Share This