Addons
Related Products
Keeps shoppers browsing by showing products from the same categories at the bottom of each product detail page.
Data flow
RelatedProductsAddonhooks intokitbix_commerce_after_product(priority 30) and only runs on product contexts.- It pulls the current product’s category IDs, queries
Product::publicPaginate()for additional items, and filters out the current product. - The view (
views/related-products.php) outputs cards with image, name, formatted price, and CTA linking tokitbix_commerce_product_permalink(). - Currency formatting relies on
kitbix_commerce_get_currency()and helper functions, so storefront and addon stay in sync.
Settings reference
| Field | Key | Description |
|---|---|---|
| Section Title | section_title |
Main heading for the block. Defaults to “Related Products”. |
| Eyebrow Text | eyebrow_text |
Optional label above the title (e.g., “You may also like”). Leave blank to hide. |
| Maximum Items | max_items |
Number of cards to render (2–8). The addon fetches extra products and truncates after this value. |
Implementation tips
- Ensure every product belongs to at least one category; otherwise no related results will appear.
- Use consistent square imagery; the template simply prints the first gallery image (or featured image) without cropping.
- If you want to exclude out-of-stock items, customize
Product::publicPaginate()via a child plugin. - CSS lives in
assets/related-products.css; extend it in your theme for grid tweaks.
Testing checklist
- Enable the addon and set title/eyebrow text to match your voice.
- Visit a product with multiple category siblings—verify the block renders and max items respected.
- Test a product in a unique category; the block should stay hidden if no related items exist.
- Check mobile breakpoints for wrapping issues; adjust theme CSS if necessary.
Common pitfalls
- Using max items above 8 causes the validation to clamp to 8, so document expectations with stakeholders.
- Deleting categories without reassigning products leaves orphaned products and empty related blocks.
- Expecting manual curation—this addon is category-driven; use featured products if you need hand-picked upsells.
Reminder: Disabling the addon only hides the UI. Settings remain stored, so you can toggle it back on without reconfiguration.