Carousel Shopify - Tambahkan Slider Produk ke Toko Kamu

Tema Shopify sudah menyertakan section slideshow dasar, tetapi biasanya hanya menampilkan satu slide sekaligus dengan kustomisasi terbatas. Kalau kamu ingin carousel yang menampilkan beberapa produk, mendukung geser sentuh, atau memakai efek seperti coverflow atau cards, kamu butuh sesuatu yang lebih.
Panduan ini menunjukkan cara menambahkan carousel slider ke Shopify dengan OneType Transforms - satu tag script di file tema dan section Custom Liquid untuk HTML carousel. Tanpa aplikasi Shopify yang harus dipasang. Untuk gambaran fitur lengkap, lihat panduan utama carousel slider.
Cara menambahkan carousel slider ke Shopify
Kamu memerlukan Shopify paket Basic ke atas. Paket Starter tidak menyertakan toko online.
Langkah 1: Tambahkan tag script ke theme.liquid
- Buka Online Store > Themes
- Klik tiga titik pada tema aktif kamu > Edit code
- Buka Layout > theme.liquid
- Cari
</head>(gunakan Ctrl+F) - Tempel tag script tepat di atasnya
- Klik Save
<script src="https://cdn.transforms.onetype.ai/bundle/{YOUR-TOKEN}.js" defer></script>
Ambil token kamu di transforms.onetype.ai/get-started. Atribut defer adalah praktik terbaik Shopify - script diunduh segera tetapi dijalankan setelah HTML selesai diurai.
Tips: Duplikat tema kamu sebelum mengedit (Theme actions > Duplicate) agar punya cadangan.
Langkah 2: Tambahkan carousel ke halaman mana pun
Lewat Theme Editor (tanpa mengedit kode):
- Buka Online Store > Themes > Customize
- Pilih halaman yang kamu inginkan (Beranda, Produk, Koleksi, dll.)
- Klik Add section > Custom Liquid
- Tempel HTML carousel di kolom kode Liquid
- Seret section ke posisi yang kamu inginkan
- Klik Save
<div ot="swiper" ot-navigation="true" ot-pagination="bullets" ot-autoplay="true" ot-loop="true">
<div><img src="https://cdn.shopify.com/your-image-1.jpg" alt="Product 1"></div>
<div><img src="https://cdn.shopify.com/your-image-2.jpg" alt="Product 2"></div>
<div><img src="https://cdn.shopify.com/your-image-3.jpg" alt="Product 3"></div>
</div>
Contoh carousel untuk Shopify
Carousel kartu produk:
<div ot="swiper" ot-slides-per-view="3" ot-space-between="20" ot-navigation="true" ot-grab-cursor="true">
<div class="product-card">
<img src="product-1.jpg" alt="Product 1">
<h3>Product Name</h3>
<p>$29.99</p>
</div>
<div class="product-card">
<img src="product-2.jpg" alt="Product 2">
<h3>Product Name</h3>
<p>$39.99</p>
</div>
<div class="product-card">
<img src="product-3.jpg" alt="Product 3">
<h3>Product Name</h3>
<p>$49.99</p>
</div>
<div class="product-card">
<img src="product-4.jpg" alt="Product 4">
<h3>Product Name</h3>
<p>$59.99</p>
</div>
</div>
Banner hero dengan autoplay:
<div ot="swiper" ot-effect="fade" ot-autoplay="true" ot-autoplay-delay="4000" ot-loop="true" ot-pagination="progressbar">
<div><img src="banner-1.jpg" alt="Summer Sale" style="width:100%;"></div>
<div><img src="banner-2.jpg" alt="New Arrivals" style="width:100%;"></div>
<div><img src="banner-3.jpg" alt="Free Shipping" style="width:100%;"></div>
</div>
Memakai Liquid untuk carousel dinamis
Karena section Custom Liquid mendukung templating Liquid milik Shopify, kamu bisa membuat carousel dinamis yang mengambil data dari toko kamu. Misalnya, carousel produk dari koleksi tertentu:
<div ot="swiper" ot-slides-per-view="3" ot-space-between="20" ot-navigation="true">
{% for product in collections.featured.products limit: 8 %}
<div>
<img src="{{ product.featured_image | image_url: width: 400 }}" alt="{{ product.title }}">
<p>{{ product.title }}</p>
<p>{{ product.price | money }}</p>
</div>
{% endfor %}
</div>
Kode ini mengambil hingga 8 produk dari koleksi "featured" kamu dan membuat satu slide untuk setiap produk. Carousel diperbarui otomatis saat kamu mengubah koleksinya.
Catatan penting
- Mengedit theme.liquid secara langsung berarti perubahan bisa hilang saat tema diperbarui - selalu duplikat dulu
- Section Custom Liquid yang ditambahkan lewat Theme Editor tetap aman saat tema diperbarui
- Carousel tidak berfungsi di halaman checkout (pembatasan Shopify)
- Tidak ada masalah CSP - storefront Shopify mengizinkan script CDN pihak ketiga
Untuk daftar lengkap opsi dan efek, lihat panduan lengkap carousel slider. Jelajahi semua transform di transforms.onetype.ai.