Swiper carousel for product recommendations

Topic summary

A Shopify store owner is attempting to implement a Swiper carousel for product recommendations that displays 4 products on desktop and 2 on mobile. They successfully implemented this carousel on their wall art collection page using product-carousel.liquid, as shown in their first screenshot.

However, when trying to replicate the same functionality in related-products.liquid using code shared via Codeshare, the carousel fails to render properly on individual product pages. Instead of displaying multiple products in a sliding carousel format, the products appear in a different layout (shown in second screenshot).

The issue remains unresolved, with the user seeking help to understand why the carousel code works on the collection page but not on the product page for related products.

Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

Hello, I’m trying to show products in a carousel for my webshop. 4 products should show at the same time on desktop, and 2 for phone. I got this exact carousel using swiper on: Wall Art – Transform Your Space with Style and Elegance – InteriorGlows from product-carousel.liquid. Which looks like:

But I’m now trying to add it to my related-products.liquid using this code: Jan 05 11:52 AM - Codeshare. But it just results in: LINK: Rose LED Tree Lamp – Decorative LED Table Lamp with Adjustable Lighting – InteriorGlows

Does anyone know why my products on my product page are not showing in a carousel?