Repository navigation
02/50 — Editing one Shopify product changes all products? Template fix + free Liquid code #5
vistabylara-dev
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
عدّلت صفحة منتج واحد فتغيّرت باقي المنتجات؟
قد تكون عدّلت القالب المشترك، وليس بيانات المنتج وحده. اختيار منتج في معاينة محرر القالب لا يعني أن التعديلات ستقتصر عليه.
في هذا الدليل: متى تستخدم قالباً منفصلاً، ومثال كود مجاني يعرض ملاحظة على منتج تختاره أنت فقط.
تنبيه: انسخ القالب وجرّب على النسخة غير المنشورة. المثال اجتاز فحص الكود، لكنه لم يُختبر على قالب متجرك. لا تستخدم شرط الإظهار لإخفاء نموذج الشراء أو السعر أو الصفحة كاملة.
Problem 02/50: Why does editing one Shopify product page change all products?
You add a care note for one item. Then you open another product and see the same note there.
For a customer, this can mean reading delivery or care instructions that do not apply to what they are buying.
Short answer: Products using the same template share its layout and section settings. Choosing a product in the editor's preview does not give that product its own template. Product records and template settings are different things.
Choose the fix that matches your need
No-code option: a separate product template
In a duplicate theme, open the editor's product template selector and create a new template based on the existing one. Customize it and preview the intended product.
Previewing is not assignment. Assign the template through Products → chosen product → Theme template → Save when it is available in the live theme. The assignment dropdown uses templates in the published theme; an unpublished-only template may not appear there.
Do not publish an unfinished theme merely to make a template selectable. Review the complete theme before deployment.
Free code suggestion: show one note only on the selected product
This creates a separate section with a product picker and rich-text note. Its content is rendered only when the current product matches the chosen product. It does not change product records or template assignments.
Compatibility: A theme with product templates supporting addable sections. This example is for Online Store theme code, not the Shop app or a headless storefront.
Exact placement and complete code
sections/vbl-single-product-note.liquid. If it already exists, inspect it rather than overwrite it.theme.liquid.{% if request.page_type == 'product' %} {% assign target_product = section.settings.target_product %} {% if target_product != blank and product.id == target_product.id %} {% if section.settings.note != blank %} <div class="vbl-single-product-note"> {{ section.settings.note }} </div> {% endif %} {% endif %} {% endif %} {% stylesheet %} .vbl-single-product-note { max-width: 48rem; margin-inline: auto; padding: 1rem; line-height: 1.6; overflow-wrap: anywhere; } {% endstylesheet %} {% schema %} { "name": "VBL single product note", "tag": "div", "enabled_on": { "templates": ["product"] }, "settings": [ { "type": "product", "id": "target_product", "label": "Show only on this product" }, { "type": "richtext", "id": "note", "label": "Product note" } ], "presets": [ { "name": "VBL single product note" } ] } {% endschema %}Set it up without editing the code
In the same draft theme's editor, open the intended product template.
Add VBL single product note. Under Show only on this product, select the product. Enter accurate text under Product note, then save.
Preview the selected product on that template. You must select a product and supply note text: the example deliberately starts empty so it cannot publish an invented policy or delivery promise.
The condition compares product IDs. The product picker avoids requiring an owner to find and hardcode a URL handle.
Test both sides of the condition
Also verify that the original product title, images, price, variants and Add to cart still behave as before.
Possible limitation: Shopify still creates an outer section wrapper. Some themes add spacing to that wrapper even when the inner note is empty. If you see an unwanted gap, do not apply a global “hide empty sections” rule; ask for a fix scoped to this section and your theme.
This is a small, single-product example. Adding dozens of conditional note sections to one template becomes difficult to maintain. If your catalogue needs different content for many products, plan a structured per-product content solution instead.
Rollback
Remove this new section from every template where you added it, then save. Delete only the new section file after confirming nothing references it.
For the separate-template approach, record the product's original assignment before changing it and restore that assignment if needed. A theme copy does not back up product data or product template assignments.
Verification and references
Code validation passed: Shopify AI Toolkit's Liquid/theme validator reported that
vbl-single-product-note.liquidpassed all checks.Still requires store testing: Theme styling, outer-wrapper spacing, preview behaviour, product availability and app interactions. No live merchant store was modified or tested for this guide.
Official references, reviewed 24 October 2026:
Tell us what you need to change
Reply with your theme name/version, whether you need a different layout or just different text, and the affected template name. Remove credentials and customer information from screenshots or code.
Previous: section missing from Add section · 50-topic roadmap · Main free code discussion
Join our free LinkedIn group and follow Dr Lara on GitHub for practical Shopify guidance.
Call Dr Lara on +971 50 799 4292 for free Shopify guidance and a free consultation.
Ask on WhatsApp · Visit Vista by Lara
Public examples and initial guidance are free. Any separate hands-on implementation is scoped and agreed first.
Dr Lara | Vista by Lara
All reactions