Skip to main content

Generate pickup points

Early access

The Pickup Points Delivery Option Generator API is a feature that's available by request to merchants on the Shopify Plus plan. Merchants must be enrolled in the Partner program in order to deploy custom solutions they have developed for themselves. To request access, contact pickup-point-generator-early-access@shopify.com. You can test the Pickup Points Delivery Option Generator API on Partner development stores without requesting access.

Customers can choose to have their order sent to a pickup point instead of to their address.

In this guide, you'll learn how to generate custom pickup point options using Shopify Functions. You'll create a starter function with some logic to support pickup points for a specific location. You'll also learn how to retrieve the pickup point that the customer selected, using the GraphQL Admin API.


In this tutorial, you'll learn how to do the following tasks:

  • Generate starter code for Shopify Functions
  • Use GraphQL to define the input of your function
  • Test the delivery option generator and review function logs
  • Retrieve the selected pickup point for an order, using the GraphQL Admin API
  • Deploy your function to the Shopify platform.

Plus

Only custom apps that are built for stores on the Shopify Plus plan have access to the Pickup Point Delivery Option Generator API. Public apps in the Shopify App Store and custom apps built for stores on non-Plus plans don't have access.

Anchor to Rust-specific requirementsRust-specific requirements

The following requirements are specific to Rust-based development with Shopify Functions.

  • You've installed Rust.

    On Windows, Rust requires the Microsoft C++ Build Tools. Make sure to select the Desktop development with C++ workload when installing the tools.

  • You've installed the wasm32-wasip1 target:

    Terminal

    rustup target add wasm32-wasip1

Anchor to Step 1: Create the pickup point delivery option generator functionStep 1: Create the pickup point delivery option generator function

Use Shopify CLI to generate a pickup point delivery option generator starter function. Shopify CLI generates the function, specifies the function's inputs using an input query, and implements the function logic. Learn more about the function that's generated.

  1. Navigate to your app directory:

    Terminal

    cd <directory>
  2. Create a new pickup point delivery option generator extension with the following command:

    Terminal

    shopify app generate extension --template pickup_point_delivery_option_generator --name pickup-points-generator
  3. Choose the language to use. For this tutorial, you should select either Rust or JavaScript.

    For handling large data payloads, consider using Rust, as it may help avoid exceeding Shopify's instruction limit, potentially preventing an InstructionCountLimitExceededError.

    Tip

    Shopify Functions support any language that compiles to WebAssembly (Wasm), such as Rust, AssemblyScript, or TinyGo. You specify the Wasm template option when you're using a language other than Rust and can conform to the Wasm API. Learn more about the Wasm API.

  4. Navigate to extensions/pickup-points-generator:

    Terminal

    cd extensions/pickup-points-generator

Anchor to Step 2: Preview the function on a development storeStep 2: Preview the function on a development store

To test your function, you need to make it available to your development store.

  1. If you're developing a function in a language other than JavaScript or TypeScript, ensure you have configured build.watch in your function extension configuration.
  1. Navigate back to your app root:

    Terminal

    cd ../..
  1. Use the Shopify CLI dev command to start app preview:

    Terminal

    shopify app dev

    You can keep the preview running as you work on your function. When you make changes to a watched file, Shopify CLI rebuilds your function and updates the function extension's drafts, so you can immediately test your changes.

  2. Follow the CLI prompts to preview your app, and install it on your development store.

Note

If your app is already running, then you need to stop and restart it.


Anchor to Step 3: Set up shipping to pickup pointsStep 3: Set up shipping to pickup points

For pickup points to be available at checkout, your store needs to have at least one location with pickup points enabled.

  1. In the Shopify admin, go to Settings > Shipping and delivery.
  2. Under Shipping to pickup points, select a location.
  3. Enable the option to ship to pickup points from the location.
  4. Click Edit rate.
  5. Under Apply rate to pickup points provided by, select your extension.
  6. Click Done.
  7. Click Save.

Anchor to Step 4: Test the pickup point delivery option generatorStep 4: Test the pickup point delivery option generator

You can test your pickup point delivery option generator to ensure that it's working as expected.

  1. In your development store, add a product to your cart and proceed to checkout.

    The product must be available from the configured location.

  2. In checkout, select Ship to pickup point.

  3. Type an address in Canada, and click Search. If you're in Canada, then you can use your location.

  4. To view available pickup points, select either Map or List.

  5. Select a location.

  6. Click Continue to payment.

    The Payment page displays the address that you selected.


Anchor to Step 5 (Optional): Debug the functionStep 5 (Optional): Debug the function

To debug your function, or view its output, you can review its logs.

  1. Log in to your Partner Dashboard.
  2. Navigate to Apps and select your app.
  3. Click Extensions > pickup-points-generator.
  4. Click on any function run to view its input, output, and any logs written to STDERR.

Anchor to Step 6: Retrieve the pickup point from an orderStep 6: Retrieve the pickup point from an order

You can retrieve a pickup point from an order with the GraphQL Admin API.

To query the pickup point, you need to request access to protected customer data in the Partner Dashboard. Your app also needs to meet specific requirements to ensure customer privacy and security.

Add the read_orders and read_merchant_managed_fulfillment_orders access scopes to your app.

  1. If your app is running, stop it.

  2. In shopify.app.toml, update scopes to include the required access scopes. The following is an example:

    shopify.app.toml

    scopes = "read_products,read_merchant_managed_fulfillment_orders,read_orders"
  3. Deploy your changes with the following command:

    Terminal

    shopify app deploy
  4. When prompted, release the new version.

  5. Restart your server for the changes to take effect:

    Terminal

    shopify app dev

Anchor to Retrieve the pickup pointRetrieve the pickup point

Request the pickup point from the GraphQL Admin API's DeliveryMethod object. You'll request data from the deliveryOptionGeneratorPickupPoint field.

  1. Complete the order that you started.

  2. In Shopify CLI, where your server is running, press g to open GraphiQL in your browser.

  3. In GraphiQL, run the following query, with the ID of the order that you created.

    This example returns the IDs of the pickup point and the function that generated the pickup point option.

    POST https://{shop}.myshopify.com/api/{api_version}/graphql.json

    GraphQL query

    query {
    order(id: "gid://shopify/Order/{ORDER_ID}") {
    id
    fulfillmentOrders(first: 10, displayable: true) {
    edges {
    node {
    deliveryMethod {
    methodType
    deliveryOptionGeneratorPickupPoint {
    externalId
    functionId
    }
    }
    }
    }
    }
    }
    }

    JSON response

    {
    "data": {
    "order": {
    "id": "gid://shopify/Order/1",
    "fulfillmentOrders": {
    "edges": [
    {
    "node": {
    "deliveryMethod": {
    "methodType": "PICKUP_POINT",
    "deliveryOptionGeneratorPickupPoint": {
    "externalId": "1",
    "functionId": "f0c17828-da1a-4748-810d-3c3cab2bc977"
    }
    }
    }
    }
    ]
    }
    }
    }
    }

Anchor to Step 7 (Optional): Edit the selected pickup pointStep 7 (Optional): Edit the selected pickup point

You can edit the selected pickup point option, either on the order or on the fulfillment page for a pickup order that's completed using pickup points functions.

  1. In the Shopify admin, go to Orders page.

  2. Click the order you just completed using pickup points.

  3. Next to Pickup point address, click the pencil icon.

    In the modal that displays, edit the pickup point address.

  4. After you've edited the address, click Search.

    Installed pickup points functions will run and a list of pickup points will be returned.

  5. Select a new pickup point delivery option.

  6. Click Done.

To edit the selected pickup point option on the fulfillment page, fulfill the order and repeat the steps above.


  • Review the UX guidelines for pickup points, to seamlessly integrate your app into the checkout experience.
  • Learn more about how Shopify Functions work and the benefits of using Shopify Functions.
  • Learn how to use variables in your input query.
  • Review the developer tools and resources to build for pickup points, including the Pickup Point Delivery Option Generator API reference.

Was this page helpful?