Shopify / Shopify/liquid

[Proposal] Passing other variable values to a snippet

Open
#1,938 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Feature Request
Dominant language
Ruby
Stars
11.9k
Forks
1.5k
Avg merge
17h 55m
Merged PRs (30d)
3

Description

Hi I was wondering if it´s possible to add other variable values to snippet renders?
I find it cumbersome to have to capture a value only to send that value to the snippet. It would be a lot nice if we could be able to add variables into strings, like this example with the button_id.

It would also be great to be able to add translations directly or other filters like capitalize instead of having to capture it.

{% render 'base-button',
  button_id: '{{ id }}-trigger',
  button_aria_label: 'general.my_translation' | t
%}

If it´s already possible and I´m just using the wrong syntax, that would be great to know, otherwise it would be a nice upgrade for the developer experience.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named. Start by locating the snippet render implementation and existing tests for render arguments; done means supporting the proposed interpolated values and filters, with coverage for both examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
developer-experience
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.