Personalized checkout and custom promotions with Shopify Scripts
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,
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
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.
{% if section.settings.product_vendor_enable %}
<p class="product-meta" itemprop="brand">{{ product.vendor }}</p>
{% endif %}
{% if section.settings.product_vendor_enable %}
{% if product.metafields.show.vendor == "1" %}
<p class="product-meta" itemprop="brand">{{ product.vendor }}</p>
{% endif %}
{% endif %}
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.
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,
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!
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024