Restrict Shipping for Customer Groups on Shopify


You may want to restrict shipping methods from showing for a certain customer group on your Shopify store. For example, if you don’t want to show certain shipping options just to your Retail Customer Group, but you do want them to apply for your Wholesale Customer Group. In this doc, we’ll walk through an example restricting our “VIP” shipping to the VIP customer group.


In order to set this up you need to have

  1. Shopify Plus store – and access to the Shopify Script Editor
  2. Shipping rates configured in ShipperHQ for your standard and VIP customers


In this example, we have a table rate carrier setup with two shipping methods: Standard (method code is delivery) and VIP (method code is delivery_vip). We also have a customer group in Shopify of VIP

Shopify Plus Store Setup

  1. Go to your Shopify Plus store admin area
  2. Install “Script Editor” app from the Shopify App Store

Create Script in Shopify Script Editor

  1. Go to your Apps / Script Editor and click Create Script
  2. Select any script category and click “Create Script” inside modal dialog.
  3. Change the Title of your script and leave the Channels set to Online Store and Storefront API channels
  4. Switch to Code tab and paste the following script inside “Ruby source code“:
    VIP_SHIPPING_METHOD = "delivery_vip"
    if !Input.cart.customer.nil? and Input.cart.customer.tags.include?(VIP_CUSTOMER_TAG)
        Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate|
        Output.shipping_rates = Input.shipping_rates.delete_if do |shipping_rate|
  6. Click “Save and publish”
  7. Tag some customer with a “VIP” tag
  8. Go to your Shopify Plus storefront

Now VIP shipping method should only be visible to the customer tagged with the VIP tag:

Other customers should see only “Delivery” method:


Fo debugging you can use Input tab to modify input parameters and in the script you can use puts to dump objects to the Console (located below Ruby source code field). Then click Run script in the Output panel to see the results

Was this doc helpful?