Migrate to support Collection admin links
Admin links allow merchants to access features of your Shopify app directly from their Shopify admin.
Smart Collection and Custom Collection admin links are being deprecated in favour of Collection admin links, condensing these resources into a single point of access. It is no longer possible to register admin links for Smart Collections and Custom Collections, so apps must register for Collection admin links going forward. If you've previously configured admin links in your app for Smart Collection and Custom Collections, you can follow this guide to migrate as seamlessly as possible.
Handling Collection admin link requests
When the merchant clicks on the Collection link in their Shopify admin, a request will be sent to the address specified by the Link target URL. For Collection details links, Shopify will append the type
query parameter with a value of smart
or custom
so that your app can retrieve the correct resource from Shopify.
Here's a simple example for handling Collection details admin links in Ruby with Sinatra and shopify_api:
require 'sinatra'
get '/links/collection_details' do
type = params[:type]
collection_id = params[:id]
shop = params[:shop]
# Perform authentication logic and instantiate session
# ...
case type
when 'smart'
collection = ShopifyAPI::SmartCollection.find(collection_id)
return collection.title
when 'custom'
collection = ShopifyAPI::CustomCollection.find(collection_id)
return collection.title
else
return [400, "Hey, what's the big idea!?"]
end
end
Register for Collection admin links
Once your application is setup correctly to handle requests, the next step is to register for Collection admin links in the partner dashboard.
- Login to your partner dashboard.
- Click Apps.
- Select the application you wish to register Collection admin links for.
- Click Extensions.
- Under the heading Admin Links, click Add an admin link
- In the Add Link dialog, enter your Link label, Link target URL (this is where Shopify will send the request), and select Collection details or Collection overview for Pages where the link will appear.
- After you've verified that your new Collection admin links are working correctly, delete the old admin links for Custom Collection and Smart Collection resources to make sure that the actions are not duplicated in the merchant's admin.