Displaying PLP Based on Customer Login Status with Metafield Matching in Liquid using Custom App

Displaying PLP Based on Customer Login Status with Metafield Matching in Liquid using Custom App

Anish2001
Shopify Partner
1 0 1

Hi Shopify Community,

I’m working on a custom solution for a collection page in Shopify (Dawn theme) where:

  1. Non-active users see the default collection page (all products).

  2. Active (logged-in) users see the same page but filtered to display only products matching their company’s metafield value.

I’ve achieved the filtering logic in Liquid by checking {% if customer %} and filtering products using metafields (e.g., product.metafields.namespace.company vs. customer.metafields.namespace.company). However, this breaks:

  • Pagination: The pagination links don’t account for the filtered subset, showing the original count/URLs.

  • Performance: The collection object still loads all products before filtering, which isn’t scalable.

Since Liquid is server-side and the collection object is pre-rendered, I understand that dynamic filtering + pagination can’t be achieved purely with Liquid.

I’d like to implement this using a custom Remix app with an App Extension to:

  1. Handle the logic dynamically (fetch products based on user status).

  2. Preserve pagination, filters, and sorting.

Has anyone implemented something similar? Any guidance on structuring the Remix app or alternative approaches would be greatly appreciated!

Reply 1 (1)

Stevepro099
New Member
5 1 1

Hi there,

You're absolutely right about the limitations of using Liquid for this type of dynamic filtering. Since Liquid renders server-side and the collection.products object is preloaded, it’s not scalable for filtering products based on customer metafields — especially when pagination and performance are involved.

Using a custom Remix app with an App Extension is a solid direction. Here's a suggested approach:

  1. Custom Product Grid
    Use an App Embed block or App Proxy to insert a custom product grid component. This allows you to bypass the default Dawn collection rendering and show only the products relevant to the logged-in customer.

  2. Storefront API
    Query products dynamically using the Storefront API. You can filter based on metafields or tags that match the customer’s company value. This gives you full control over the product list, pagination, and sorting.

  3. Customer Authentication
    Ensure you're securely accessing the customer’s metafields. If you're using Shopify’s new customer accounts, make sure your app is properly authenticated and authorized to read metafields tied to the logged-in user.

  4. Pagination and Sorting
    The Storefront API supports cursor-based pagination, so you can implement accurate next/previous pages and sorting without relying on the built-in Liquid pagination logic.

  5. Fallback for Non-Logged-In Users
    Serve the default collection page to guests, either by leaving the existing Dawn layout untouched or serving a simplified fallback view via your app.

This approach gives you flexibility and keeps performance in check by avoiding unnecessary product loads. If you need help setting up the Storefront API queries or structuring the Remix routes, I’m happy to share more.

Has anyone else implemented something like this? Would be great to hear how others approached dynamic filtering in a customer-specific way.