Combined Listings in Hydrogen
This recipe lets you more precisely display and manage combined listings on product pages and in search results for your Hydrogen storefront. A combined listing groups separate products together into a single product listing using a shared option like color or size. Each product appears as a variant but can have its own title, description, URL, and images. In this recipe, you'll make the following changes:
- Set up the Combined Listings app in your Shopify admin and group relevant products together as combined listings.
- Configure how combined listings will be handled on your storefront.
- Update the
ProductFormcomponent to hide the Add to cart button for the parent products of combined listings. - Update the
ProductImagecomponent to support images from product variants and the product itself. - Show a range of prices for combined listings in
ProductItem.
This recipe is compatible with React Router 7.9.x and uses consolidated imports from 'react-router' instead of separate '@shopify/remix-oxygen' and '@remix-run/react' packages.
This recipe is compatible with React Router 7.9.x and uses consolidated imports from 'react-router' instead of separate '@shopify/remix-oxygen' and '@remix-run/react' packages.
Anchor to RequirementsRequirements
- Your store must be on either a Shopify Plus or enterprise plan.
- Your store must have the Combined Listings app installed.
Anchor to IngredientsIngredients
New files added to the template by this recipe.
| File | Description |
|---|---|
| app/lib/combined-listings.ts | The combined-listings.ts file contains utilities and settings for handling combined listings. |
Anchor to Step 1: Set up the Combined Listings appStep 1: Set up the Combined Listings app
-
Install the Combined Listings app.
-
Add tags to the parent products of combined listings to indicate that they're part of a combined listing (for example
combined).
Anchor to Step 2: Configure combined listings behaviorStep 2: Configure combined listings behavior
You can customize how the parent products of combined listings are retrieved and displayed.
To make this process easier, we included a configuration object in the combined-listings.ts file that you can edit to customize according to your preferences.
Anchor to Step 3: Add combined listings utilitiesStep 3: Add combined listings utilities
Create a new combined-listings.ts file that contains utilities and settings for handling combined listings.
File
- Update the
ProductFormcomponent to hide the Add to cart button for the parent products of combined listings and for variants' selected state. - Update the
Linkcomponent to not replace the current URL when the product is a combined listing parent product.
File
Anchor to Step 5: Support product and variant imagesStep 5: Support product and variant images
Update the ProductImage component to support images from both product variants and the product itself.
Anchor to Step 6: Show a range of prices for combined listings in ProductItemStep 6: Show a range of prices for combined listings in Product Item
Update ProductItem.tsx to show a range of prices for the combined listing parent product instead of the variant price.
Anchor to Step 7: (Optional) Redirect to the first variantStep 7: (Optional) Redirect to the first variant
If you want to redirect automatically to the first variant of a combined listing when the parent handle is selected, add a redirect utility that's called whenever the parent handle is requested.
Anchor to Step 8: Filter combined listings from the all products pageStep 8: Filter combined listings from the all products page
Add filtering to the all products catalog page to exclude combined listing parent products.
Anchor to Step 9: Filter recommended productsStep 9: Filter recommended products
- Add the
tagsproperty to the items returned by the product query. - (Optional) Add the filtering query to the product query to exclude combined listings.
File
Anchor to Step 10: (Optional) Filter out combined listings from collections pagesStep 10: (Optional) Filter out combined listings from collections pages
Since it's not possible to directly apply query filters when retrieving collection products, you can manually filter out combined listings after they're retrieved based on their tags.
File
Anchor to Step 11: Show price ranges on product pagesStep 11: Show price ranges on product pages
- Display a range of prices for combined listings instead of the variant price.
- Show the featured image of the combined listing parent product instead of the variant image.
- (Optional) Redirect to the first variant of a combined listing when the handle is requested.
File
Anchor to Step 12: Style the price range displayStep 12: Style the price range display
Add a class to the product item to show a range of prices for combined listings.
Anchor to Next stepsNext steps
- Test your implementation by going to your store and searching for a combined listing. Make sure that the combined listing's details appear in the search results and on the product page.
- (Optional) Place a test order to see how orders for combined listings appear in your Shopify admin.