Adding text from a Snippet to product descriptions and FAQs

Hello! I am using the Streamline theme from Archetype Themes.

I am trying to add product lead times to my product descriptions and my FAQ page that can be edited in one place. I think I would need two different lead time snippets to cover our custom products and our stock products. I would identify these different products with “custom” and “stock” tags. My thought is to use the ‘render’ tag in the product description text editor and FAQ text editor to populate the different lines of text. How would I best create the snippets and any additional code to generate these lines of text? Many thanks!

Hello BrassHardware, I’m wondering if you were able to find a solution for this scenario. I’m looking to update portions of product descriptions that are the same for a larger number of items. I would definitely appreciate if you could share any insights.

Hi, sure thing! Everything was done in the Snippets folder of the Theme Code Editor in conjunction with Product Tags:

  1. Create a product tag. In my case I created the tag “Custom Lead Time”
  2. In Theme Code Editor > Snippets:
    1. Create a Snippet for the text you want to add to your description (click “+ Add a new snippet”). I named mine “lt-custom-products.liquid”. In the code field simply write what you want to be displayed.
    2. In your product-template.liquid snippet (name may be different depending on your theme) add in code to render your text in the product description. I have two additional tags for custom text which generate different text. Here is how I did mine with the added code in bold:

{%- when ‘description’ -%}

{%- assign id = block.id | append: product.id -%} {%- render 'product-description', id: id, product: product, is_tab: block.settings.is_tab -%} **{% if product.tags contains 'Custom Lead Time' %}** **{% render 'lt-custom-products' %}** **{% elsif product.tags contains 'Stock Lead Time' %}** **{% render 'lt-stock-products' %}** **{% elsif product.tags contains 'Specialty Stock Lead Time' %}** **{% render 'lt-extended-stock-product' %}** **{% endif %}**

This places the added text below your product description. You can go in to your text snippet and change it at any time. Hope this helps!