would like to customize presentation of product.vendor in Debut

Highlighted
Excursionist
13 2 2

I want to manipulate the string variable {{product.vendor}} and customize the way it looks for all products.  Don't want to edit products directly or in bulk.  Long story short - products are uploaded by a third-party program and I don't like the way Shopify displays the vendor (Lastname, Firstname vs. Firstname Lastname).  Can't change it on the program end.  Need to change the Shopify template.  

 

Problem 1:  I can't find {{product.vendor}} in product-template.liquid, except in the {% schema %} section:

 {
"type": "checkbox",
"id": "show_vendor",
"label": {
"de": "Lieferanten anzeigen",
"en": "Show vendor",
"es": "Mostrar proveedor",
"fr": "Afficher les vendeurs",
"it": "Mostra fornitore",
"ja": "販売元を表示する",
"pt-BR": "Exibir fornecedor"
},
"default": false

 

I think it is supposed to be located in the body of the code but I search and it's not there.  Where oh where could it be?  

 

Problem 2:  I see the python-like string methods at https://help.shopify.com/en/themes/liquid/filters/string-filters

and can see how to parse the string to what I want.  Can I just set {{product.vendor}} equal to my new string and it will be handled correctly in each instance of product?  How do I get the modified string to be used?  

 

Thanks 

Ed K

 

0 Likes
Excursionist
13 2 2

OK, with some study problem 2 is figured out:  

 

If product. vendor is of the form "Lastname, Firstname - Vendor ID"

this code renders it as "Firstname Lastname"

 

        {% assign realname_noComma = product.vendor | split: "," %} 
        {% assign lastname = realname_noComma[0] %}

        {% assign firstname_noDash = realname_noComma[1] | split: "-" %}
        {% assign firstname = firstname_noDash[0] %}

        {% assign name = firstname | append: lastname %}
        
        {{name}}

Now the big problem is, how the heck does product.vendor get on the page in the first place?  I have "Show vendor" checked, and it does show the vendor on the rendered page.  But I can't see where in the code product.vendor gets output to the page.  It just appears between the "product-single__title" and "product__price".  Magic.  

 

In the Debut theme, product-template.liquid places product.vendor on the page without showing it explicitly in the code.  How?

0 Likes