Daftar Posisi Hook dan Batasan Block Theme (LarisTurbo)
Semua posisi Custom Content Hooks di halaman produk dan shop, hook WooCommerce di baliknya, serta mengapa fitur tidak tersedia di block theme.
Tutorial ini melengkapi panduan dasar Custom Content Hooks. Di sini Anda akan menemukan daftar lengkap posisi, hook teknis, dan batasan tema.
Block theme: fitur tidak tersedia
Jika situs memakai block theme, halaman Settings menampilkan pesan:
Sorry, this feature is not available for Block Theme, please use your Site Editor directly to add custom content to your WooCommerce pages.
is_enabled() mengembalikan false pada block theme meskipun checkbox aktif. Gunakan Site Editor / template WooCommerce block untuk konten kustom.
Fitur ini juga memerlukan tema yang memanggil template WooCommerce standar (bukan layout yang melewati semua hook).
Struktur setiap posisi di Settings
Setelah Enable Custom Content Hooks aktif, setiap posisi punya:
| Field | Fungsi |
|---|---|
| Heading (nama posisi) | Judul bagian; deskripsi + Hook: + Priority: |
| Custom Content | Editor HTML (unfiltered); shortcode diproses jika ada [...] |
| Background Color | Opsional; menambah class lt-wc-hook-with-bg |
| Text Color | Warna teks |
Output dibungkus:
<div class="lt-wc-custom-hook lt-wc-hook-{id}">...</div>
Posisi halaman produk tunggal
| Label di Settings | ID internal | Hook WooCommerce | Priority |
|---|---|---|---|
| Single Product Page - Top | product_top |
woocommerce_before_single_product |
5 |
| Single Product Page - Before Image | product_image_before |
woocommerce_before_single_product_summary |
5 |
| Single Product Page - After Image | product_image_after |
woocommerce_before_single_product_summary |
25 |
| Single Product Page - Before Summary | product_summary_before |
woocommerce_single_product_summary |
0 |
| Single Product Page - Before Add to Cart | product_atc_before |
woocommerce_single_product_summary |
28 |
| Single Product Page - After Add to Cart | product_atc_after |
woocommerce_single_product_summary |
35 |
| Single Product Page - After Summary | product_summary_after |
woocommerce_single_product_summary |
100 |
| Single Product Page - Before Product Tabs/Details | product_tabs_before |
Lihat catatan di bawah | 7 atau 48 |
| Single Product Page - After Product Tabs/Details | product_tabs_after |
Lihat catatan di bawah | 12 atau 52 |
| Single Product Page - Before Upsells/Related Products | product_upsells_before |
woocommerce_after_single_product_summary |
13 |
| Single Product Page - Bottom | product_bottom |
woocommerce_after_single_product |
99 |
Catatan posisi Before/After Image
Before Image dan After Image hanya terdaftar jika tema TokoPressID (is_theme_tokopressid()). Tema lain tidak melihat dua opsi ini di Settings.
Catatan posisi Tabs/Details
Hook untuk Before Product Tabs/Details dan After Product Tabs/Details bisa berubah jika tema memfilter:
{theme_prefix}_wc_product_details_is_below_image
Jika detail produk di bawah gambar:
- Hook →
woocommerce_before_single_product_summary - Priority → 48 (before) / 52 (after)
Jika tidak:
- Hook →
woocommerce_after_single_product_summary - Priority → 7 (before) / 12 (after)
Posisi halaman shop
| Label di Settings | ID | Hook | Priority |
|---|---|---|---|
| Shop Page - Top | shop_top |
woocommerce_before_shop_loop |
5 |
| Shop Page - Bottom | shop_bottom |
woocommerce_after_shop_loop |
99 |
Konten shop muncul di halaman arsip produk, kategori, dan tag produk yang memakai loop WooCommerce standar.
Memilih posisi yang tepat
| Kebutuhan | Posisi yang disarankan |
|---|---|
| Banner promo di atas produk | Single Product Page - Top |
| Badge di atas judul/harga | Before Summary |
| Info pengiriman dekat tombol beli | Before Add to Cart atau After Add to Cart |
| Trust badge setelah tombol | After Add to Cart |
| Tabel spesifikasi sebelum tab | Before Product Tabs/Details |
| Konten SEO panjang setelah deskripsi | After Product Tabs/Details |
| Banner di katalog | Shop Page - Top / Bottom |
After Add to Cart dan Before Add to Cart mengikuti visibilitas form add-to-cart (tersembunyi jika tombol ATC disembunyikan tema).
Shortcode dan HTML
- Konten melalui
wpautoplaludo_shortcodejika mendeteksi[. - HTML tidak difilter ketat; hati-hati hanya admin tepercaya yang mengedit.
- Warna background/teks diinjeksikan lewat CSS variable
--lt-wc-hook-*.
Filter developer
Daftar posisi bisa diperluas/diubah dengan filter:
laristurbo_wc_custom_hooks_actions
Berguna untuk plugin/tema kustom yang menambah hook sendiri.
Troubleshooting
Konten tidak muncul
- Tema block → fitur memang nonaktif.
- Tema tidak memanggil hook pada template yang Anda uji.
- Custom Content kosong untuk posisi tersebut.
- Cache halaman; coba reload tanpa cache.
Posisi “Before Image” tidak ada
- Bukan tema TokoPressID; opsi memang tidak didaftarkan.
Tabs hook “salah” posisi
- Tema mengaktifkan layout detail di bawah gambar; hook bergeser ke
before_single_product_summary(perilaku yang memang disengaja).