App Bridge Product Picker collection filter not working

The app bridge resource picker when in ‘product’ mode, has a newish ‘add filter’ UI that lets the user filter products by collections.

When the resource picker is initiated with a filter query, the collection filters no longer work.

Initialising the resource picker without a filter query:

const productPickerSelected = await shopify.resourcePicker({
  type: 'product',
  action: 'select',
  multiple: true,
  selectionIds: getInitialSelectionIds(),
  filter: {
    hidden: true,
    variants: true,
    archived: false,
  },
});

Collection filter works as expected:

Initialising the resource picker with a filter query:

const productPickerSelected = await shopify.resourcePicker({
  type: 'product',
  action: 'select',
  multiple: true,
  selectionIds: getInitialSelectionIds(),
  filter: {
    hidden: true,
    variants: true,
    archived: false,
    query: `bundles:false`,
  },
});

Collection filter returns no results:

Expected behaviour
When passing in a filter.query, the additional filters the user applies inside the resource picker UI should apply on top of the filter.query.

In the above example, the product picker should be returning the exact same results.

Additional details
We’re using @shopify/app-bridge-react v4.2.0

Our use case is selecting products for a bundle, so we must filter out all bundle products from being selected by the user (bundles can’t be in bundles).

The example above where items in the collection are showing are not bundles.

Thanks,
Anthony

Hey again @Anthony_SL :waving_hand: - I can definitely look into this, it seems quite odd for sure. Would you be able to share a quick repro snippet if possible (just so I can quickly load this into an App Bridge app on my end) and I’ll try to reproduce this. I’m thinking my next step will be to get in touch with our product team here for you, but I’d like to try to replicate first in case we can narrow down the issue that way - hope to speak soon!

Hi @Alan_G, so sorry for the delayed response on this one. Just had another merchant flag this so it put this back on my radar.

Try the below snippet - assume its a react app, and you’re already inside the app bridge provider.

import {useAppBridge} from '@shopify/app-bridge-react';

function getInitialSelectionIds() {
  // Return an array of resource objects, e.g.:
  // [{ id: 'gid://shopify/Product/12345' }]
  return [];
}

async function openProductPicker(shopify) {
  const productPickerSelected = await shopify.resourcePicker({
    type: 'product',
    action: 'select',
    multiple: true,
    selectionIds: getInitialSelectionIds(),
    filter: {
      hidden: true,
      variants: true,
      draft: undefined,
      archived: false,
      query: `bundles:false`,
    },
  });

  // Do something with the selected products
  console.log('Selected products:', productPickerSelected);
}

export default function ProductPickerButton() {
  const shopify = useAppBridge();

  return (
    <button
      onClick={() => openProductPicker(shopify)}
    >
      Open Product Picker
    </button>
  );
}

Thanks @Anthony_SL, no worries at all. I’ll try to replicate this on my end and get in touch with our product team for you so we can investigate further. I’ll loop back with you here once I have more info/need anything from your end. Really appreciate you sending this over!

1 Like

Hey @Alan_G - Just checking in if there’s any update on this bug. Thanks.

Hey @Anthony_SL, thanks for following up. I still don’t have a concrete update on my end here, but I can confirm our dev teams are taking a look into this. I’ve just reached out again to see if we can share any more info, I’ll keep you updated here, thanks again for your patience as always, it’s really appreciated. :slight_smile:

1 Like

Hey again @Anthony_SL - just following up with an update. We’ve opened up a ticket on our end to investigate this as a possible bug. I’ll keep you in the loop here as always and get in touch when I can confirm a fix/next steps!

1 Like

Thanks for the update Alan! Appreciate it.

1 Like

Hi @Alan_G - just gently checking in to see if there’s an update on this bug ticket?

Thanks!

Hey @Anthony_SL :waving_hand: - thanks for the ping! Still no concrete details on a turnaround time, but I can confirm there’s been some movement on this since the last time I shared an update. We have had dev eyes on this on our end.

I’ll keep my eyes on this for you and let you know once we’re closer to a fix/confirm once it’s been pushed. Appreciate you following up as always :slight_smile:

1 Like