--- url: https://developer.youcan.shop/themes/filters/strings/replaceFirst.md --- # Replace First Replaces the first instance of a substring with a different string. ```liquid {{ string | replace_first: substring, replacement }} ``` ## Example ```liquid {{ 'red shirt, red hat' | replace_first: 'red', 'blue' }} ``` ::: tip Output ```html blue shirt, red hat ``` :::