Making a Wholesale Shopify store - Using Shopify Scripts

Making a Wholesale Shopify store
Using Shopify Scripts

Martin Cox

The scenario

Business creates an online store. Online store is working good. Business wants to allow wholesale customers to place their orders via store.

The solution(s)

Install a Shopify app. Or create a separate wholesale store.  Or try and build a solution within Shopify using discount codes.  Or a messy combination of the above.

All of these solutions have worked been ok, to an extent, for many Shopify stores, but all have limitations and are far from seamless and the wholesale customer ends up getting a second-rate experience.

And... all these solutions use discount codes. But discount codes are designed for giving customers discounts.  Wholesale customers aren't getting a discount. The wholesale price is the correct price for them.

Why discount codes are clunky

  • Discounts get applied to the entire order rather than line items.
  • Inventory management Apps on Shopify (i.e. Tradegecko) directly read the line items with their original prices and include the discount as a single line item at the end of the order.
  • Only one discount code can be applied to an order, so if you want to offer a discount code (i.e. free shipping) to wholesale customers, you can't.

Recently we had a client who was using discount codes to give wholesale customers a discount, but it was causing problems for international orders because their invoices were displaying the RRP of products instead of the wholesale price.

Instead of recoding their invoices, we used Shopify Scripts (a simple but powerful enhancement that is available to Shopify Plus customers) to create a sweet solution.

The Script Editor lets you create scripts that are run each time a customer adds items to their cart.  So instead of applying a discount code at the cart to reduce items by a percentage, the script actually updates the price of the product and the wholesale customer doesn't see any RRP or discount amounts on the cart or invoice pages.

Why Shopify Scripts is a great solution:

  • Discounts can be applied based on customer tags. For example:
    • Customers tagged wholesale-40 get 40% discount
    • Customers tagged wholesale-50 get a 50% discount
  • When customer is logged in, they see the wholesale price for all products (full price can still be displayed somewhere if you want to show the RRP). 
  • Account page and cart page can be customised for wholesale customers.
  • If you want, set a minimum amount for wholesale orders. You can block wholesale customers from proceeding to checkout page if the total price of the order is less than $500.
  • No need to use discount code. We directly change the price of line items for wholesale customers by Shopiy Script.

I'm sure we haven't even begun to push the boundaries of using Shopify Scripts. As we roll this function out for more stores we'll update this post with anything else we learn!


Have you used Shopify Scripts for something similar?  Need something like this rolled out on your store?  Just want to talk Shopify?  Drop us a line!