I have created a page with a vendor list using this code i found on here
{%- for product_vendor in shop.vendors -%}
- {{ product_vendor | link_to_vendor }}
{%- endfor -%}
I need to remove one vendor from this list using code.
Can someone advise please?
Hi, @slimmyjimmy
Greetings from the Store Watchers Support Team! Happy to help you today.
Certainly! To remove a specific vendor from your vendor list using code, you can modify the code you provided. Here’s an example of how you can achieve this:
{%- for product_vendor in shop.vendors -%}
{%- if product_vendor != 'VendorToBeRemoved' -%}
{{ product_vendor | link_to_vendor }}
{%- endif -%}
{%- endfor -%}
In the code above, replace ‘VendorToBeRemoved’ with the exact name of the vendor you wish to exclude from the list. This code snippet checks each vendor in the loop and only generates an
element if the vendor name is not ‘VendorToBeRemoved’. This way, the specified vendor will be skipped in the list. Simply insert this modified code into your page, and the vendor you want to remove will no longer be displayed in the list.
Let me know if need further assistance.
Regards,
Store Watchers Support Team
Would you happen to know how I could filter the vendor list by product type?
Say I only wanted to include vendors of a certain product type. Or exclude a certain product type if that is easier.
Hi there, if I wanted to hide multiple vendors how would I go about doing that?