How to hide '' Vendor '' for some products but show in other products that i want to

How to hide '' Vendor '' for some products but show in other products that i want to

iceyp
Excursionist
20 2 9

Hi,

I believed someone can help me, thanks in advance!

 

I like to use the vendor option for some products but leave blank for others.  As there is currently not an option to do so how do we change the liquid files to allow this?

For example ;  
As i marked, i want to show it in two products but hide in other two.

My URL ;

www.iceypyramid.com

Thank you for the help!
Regards,

Ekran Görüntüsü (1988)_LI.jpg

Replies 4 (4)

WhiteWater_Web
Shopify Partner
461 17 42

Hi there - this can be made possible with some logic on the product template file. Hit us up at [email protected] if you need a hand.

 

Thanks.

 

WhiteWater Web

A certified Shopify Partner and Expert, WhiteWater Web (WWW) is a premium digital solutions company specializing in advanced Shopify Dev, Usability/Design, and Online Strategy. WWW has been working with the Shopify platform since 2006.
[email protected]

threed
Shopify Partner
129 17 50

Alternatively, here's a free basic explanation of what you might be able to do yourself. No need to pay anyone, just a little research and work needed.

    • Differentiate the products with either a tag or a metafield. (I believe either should work.) You could leave products you don't want to show vendors alone, and add a metafield to the ones you do want to show.
    • You could make an integer metafield, like with the namespace "show" and key "vendor"; set the value to 1 on products you do want to show vendors, and either don't add the metafields to ones you don't, or set it to 0. My example will be an integer with the namespace "show" and key "vendor".
    • Go to your online store's theme page in the Shopify Admin and under "Actions", click "Edit code".
    • Find the file(s) that reference showing vendors on your products. For example, in my theme, it's "product-template.liquid".
    • Look for something like:

 

{% if section.settings.product_vendor_enable %}
		<p class="product-meta" itemprop="brand">{{ product.vendor }}</p>
		{% endif %}​

 

    • Replace it with:

 

{% if section.settings.product_vendor_enable %}
	{% if product.metafields.show.vendor == "1" %}
	<p class="product-meta" itemprop="brand">{{ product.vendor }}</p>
	{% endif %}
	{% endif %}​

 

  • This is saying, if you have selected to show the vendor in the Customize section (like in your screenshot), check to see if the metafield is set to 1. If it is, proceed and show the vendor. If it isn't, do nothing.

Metafields Guru is a free app (for now at least; I'm not sponsored) you can use to manage metafields on a product-by-product basis. Most apps will require you to pay if you want to edit them en masse.

If I helped you, please help me by marking my comment as an accepted solution.
I am open to work and have been working with the Shopify system for several years.
iceyp
Excursionist
20 2 9

Hi @threed 

Thank you for your help, i really appreciate it but i'm confused. I didn't understand what's the relation of vendor with tag/metafield. Simply, the thing i want is to hide some vendors, show others because i will classify them in Vendor as '' Best Selling '' '' Most Favorited '' and i want to leave other product's vendor blank but it doesn't let me, it just says '' Vendor can't be blank '' 


If you have time, would you mind explaning a bit more simple if we're in the same boat?
Regards,

threed
Shopify Partner
129 17 50

Hello!
Sorry for the late reply, it was my work weekend and I've just come back.
So, essentially the use of a tag or metafield is to set the products apart from each other. It marks only the ones you want the vendor to show for.

 

For example, let's say I am selling three products. Their SKUs are Pen, Shoe, and Umbrella. All of them are internally marked as having the same vendor.
I decided I only want the Shoe to have the vendor show on the product page, so I will go ahead and set the product.metafields.show.vendor to 1.
With integers like this, 1 usually means "yes" or "true", where 0 usually means "no" or "false".

So if I used the code above, it should make it so only the Shoe will show a vendor. The other products don't have the product.metafields.show.vendor set to 1, so the Liquid code knows not to show any vendor.

 

If I ever wanted to hide the vendor for Shoe, I would just change product.metafields.show.vendor to 0. Likewise, if I wanted to show the vendor for Pen or Umbrella, I would set their product.metafields.show.vendor to 1.

 

You can't have an "empty" vendor in Shopify, but you can use metafields to tell the code not to show the vendor to anyone visiting your website.

Here is the code I provided earlier, but explained. Please remove the parts after //// to make sure the code works right.

 

{% if section.settings.product_vendor_enable %} ////If I have product vendors enabled, proceed with the following code.
{% if product.metafields.show.vendor == "1" %} ////If the product has been assigned the metafield with the value 1, proceed with the following code.
<p class="product-meta" itemprop="brand">{{ product.vendor }}</p> ////Show the product's vendor
{% endif %} ////Stop checking for a metafield.
{% endif %}​ ////Stop checking if product vendors are enabled.

 


Metafields are hidden product data. It's useful to be able to group the products in a more hidden or sophisticated way than tags. You can also use metafields to show data on a product page or packing slip.

 

It is a bit confusing, but once you get it it should be a lot easier. I can try and help as best I can for free. Good luck!

If I helped you, please help me by marking my comment as an accepted solution.
I am open to work and have been working with the Shopify system for several years.