상품명 길이 줄이기 truncatewords

템플릿 설정에 상품명 길이를 변경하는 기능이 없는 경우에는 아래와 같이 직접 소스를 수정해야 한다.

상품 목록에서 상품명이 너무 길 경우 글자수를 기준으로 줄이기
소스 보기에서 아래와 같이 수정해준다.
1) 글자수 기준
{{ product.title | truncate: 30 }}
{{ “Ground control to Major Tom.” | truncate: 20 }}

2) 단어 기준
{{ product.title | truncatewords: 30 }}
{{ “Ground control to Major Tom.” | truncatewords: 3 }}
https://shopify.github.io/liquid/filters/truncatewords/

  1. Sales Channel (관리자 페이지 화면 왼쪽 아래)
  2. Online Store 클릭
  3. Themes 클릭
  4. 클릭 후 나타나는 오른쪽 화면에서 Actions 버튼을 클릭
  5. Edit Code 클릭
  6. 소스 검색창에서 product 를 입력
  7. product 가 들어간 파일들이 전부 나타남.
  8. 템플릿 마다 파일명이 다를 수 있기 때문에 관련 소스를 전부 확인해 봐야됨.
  9. product.liquid, product-grid-item.liquid