COMPANY_LOCATIONS_UPDATE aka company_locations/update webhook only triggers on first edit when modifying payload

When I edit a Company Location (NOT a store location) I only see the COMPANY_LOCATIONS_UPDATE webhook (also company_locations/update) fire once if I modify the webhook payload. Even without a handler function, if I then update the Company Location again, either changing the location name or anything about the address, I don’t see the webhook fire again.

It’s making development a challenge (not in production yet) because any time I want to test more than one simple edit I need to delete my db files, reset the db migration, uninstall the app, then do $ shopify app dev --reset and re-install it all just to make a simple edit.

I believe this hook is relatively new so if anyone has thoughts or a solution I’d appreciate it!

My app/shopify.server.js file:

import "@shopify/shopify-app-remix/adapters/node";
import {
  ApiVersion,
  AppDistribution,
  DeliveryMethod,
  shopifyApp,
} from "@shopify/shopify-app-remix/server";
import { PrismaSessionStorage } from "@shopify/shopify-app-session-storage-prisma";
import prisma from "./db.server";

const webHooksUrlObj = {
  deliveryMethod: DeliveryMethod.Http,
  callbackUrl: "/webhooks/customers/metafields",
};

const shopify = shopifyApp({
  apiKey: process.env.SHOPIFY_API_KEY,
  apiSecretKey: process.env.SHOPIFY_API_SECRET || "",
  apiVersion: ApiVersion.October24,
  scopes: process.env.SCOPES?.split(","),
  appUrl: process.env.SHOPIFY_APP_URL || "",
  authPathPrefix: "/auth",
  sessionStorage: new PrismaSessionStorage(prisma),
  distribution: AppDistribution.AppStore,
  future: {
    unstable_newEmbeddedAuthStrategy: true,
    removeRest: true,
  },
  ...(process.env.SHOP_CUSTOM_DOMAIN
    ? { customShopDomains: [process.env.SHOP_CUSTOM_DOMAIN] }
    : {}),
  webhooks: {
    COMPANY_CONTACT_ROLES_ASSIGN: {
      ...webHooksUrlObj,
      includeFields: ["company_contact.customer_admin_graphql_api_id", "company_contact.admin_graphql_api_id", "company_contact.company.admin_graphql_api_id", "company_location.admin_graphql_api_id"],
    },
    COMPANY_CONTACT_ROLES_REVOKE: {
      ...webHooksUrlObj,
      includeFields: ["company_contact.customer_admin_graphql_api_id", "company_contact.admin_graphql_api_id", "company_contact.company.admin_graphql_api_id", "company_location.admin_graphql_api_id"],
    },
    COMPANY_LOCATIONS_DELETE: {
      ...webHooksUrlObj,
      includeFields: ["admin_graphql_api_id"],
    },
    COMPANY_LOCATIONS_UPDATE: {
      ...webHooksUrlObj,
      includeFields: ["admin_graphql_api_id", "company.admin_graphql_api_id"],
    },
  },
  hooks: {
    afterAuth: async ({ session }) => {
      shopify.registerWebhooks({ session });
    },
  },
});

export default shopify;
export const apiVersion = ApiVersion.October24;
export const addDocumentResponseHeaders = shopify.addDocumentResponseHeaders;
export const authenticate = shopify.authenticate;
export const unauthenticated = shopify.unauthenticated;
export const login = shopify.login;
export const registerWebhooks = shopify.registerWebhooks;
export const sessionStorage = shopify.sessionStorage;

Works as expected if I just make the line COMPANY_LOCATIONS_UPDATE: webHooksUrlObj,

Hi CFX,

I’ve reached out to the team that owns this resource to flag this to them - will update here when I learn more.

1 Like

Hi again CFX,

Are you still seeing this issue? There was a recent fix shipped that may have resolved this.

Hi Liam, thanks for the reply, I went with another solution for this but I’ll re-test asap and let you know if it still appears to be an issue!