Show product variants in Search results and auto suggestion instead of individual products - shopify

I have a shopify shop using the turbo theme. I would like to show product variants as individual items in the search results page and the auto-suggestion box instead of showing products.
Any ideas on how to achieve this ?

If you re not a dev, I suggest you should buy an app which provide the function you want or hire a shopify expert so he can help you tweek your theme.
If you re a dev, for show product variants as individual items. You just need
{%for product in product.variant%}
Your liquid code
{% endfor %}
for the 2nd , find search.liquid in snippet and add some javascript there.

Related

Shopware 6.4.12.0 Stock display in product page

i am new to this website so maybe this question is already asked before.
i am currenlty setting up products using shopware 6, but when it comes to stock its not showing the qty but only a text (in stock), did someone else ahd this problem and does someone have an idea for me to add this.
again i am new to this, so if any info is needed please let me know.
Thanks
You probably need to adjust the template of the html page to display that information, take a look at the docs on how to do that.
But this can differ if you use a different theme then the default one. Depending on the theme you use there may be already a configuration for that.
Sorry totally forgot about this, as i found the solution for my isseu.
but for the new users, when editing the script i use box standaard html twig
you can add a new block
in my case
{% block component_product_box_STQTY %}
Stock: {{product.stock}}, Central warehouse 1-3 Days</>
{% endblock %}
the {{product.stock}} shows the actual value you have in stock
hope someone can us it

Using Porto theme 3.6.3 in Shopify how can I turn off add to cart on specific products?

In Shopify I need to control whether certain products are able to display add to cart.
In the past I have tagged the product as "hide cart" and switched theme template to a version without the button.
How could I do this using the Porto theme?
Does it have a built in method of doing this or do I need to manipulate the theme partials / templates?
The simplest way that I can think of is to add a tag to all the products that you want to hide the add to cart button from, for example hide-add-to-cart.
Then find the code that renders the button and wrap it in an unless statement:
{% unless product.tags contains 'hide-add-to-cart' %}
<button>Add to cart</button>
{% endunless %}
Does it have a built-in method of doing this or do I need to manipulate the theme partials/templates?
No, there is no way to do it, rather than modify the existing code or add a new template and assign the template to a particular product like your previous theme.
So basically there are 2 ways to achieve it:
as #Karim Tarek said you need to tag those products and then check the particular tag into snippets where the Add to cart formed and disable it or hide it.
you need to create a template where you simply copy the code from the default product template and comment the code is for Add to cart and choose this template for those products on which you don't want to show the Add to cart button.
Code samples:
1.
{% unless product.tags contains 'you tag to hide product' %}
you HTML code that formed the Add to cart button
{% endunless %}

Shopify Liquid - Can You Get a Specific Page's Metafields On A Product Page?

I have a product page in my store. All my products have an associated vendor. For each vendor, I have a custom Shopify page and on this page is attached several metafields. Metafields include things like the vendor (company) country, year founded, etc...
On my product page, I would like to show the above info about the vendor. I can get to the metafields for the vendor if I was on the custom vendor page by using something like:
{% assign vendor_country = page.metafields.mynamespace.country %}
Is there anyway to get the same metafield info if I was on a product page? In this case, the context of the Liquid page variable would not be correct by default. I need a way to set this context based on the product.vendor variable and then request the custom vendor page data.
This is possible if you know the page handle. To do so you will have to make use of pages global object. So just get a page by handle and then call the metafields.
Example Code in Product template
{{ pages['page-handle'].metafields.namespace.fieldName }}
Global Pages Object

block certain text from appearing on Shopify product pages in the description

I import my ads from eBay to Shopify (https://asiasell.com.au). In the product descriptions in the Shopify site I want to display only the text that is NOT related to eBay. I think if I do the opposite, hide eBay related text, then google might think I'm trying to hide keywords. It's a couple of paragraphs I want to NOT show. I'm going to guess that I add code to the timber.scss.liquid file. Thanks!
Like the comments say you question is very edgy in the sense that this isn't exactly about programming. However I would like to see what you've tried. For now I can just answer your question with Sudo.
You need to first find the product.liquid (I don't know what theme you're using but this is just general) and you need to do something like
{% assign description_text = 'something that is in that text' %}
{% if product.description contains {{ description_text }} %}
hide // this actually adds the class hide to this product
{% endif %}
Then in css somewhere you can do:
.hide {
display: none;
}
If you ever need help with something like this then you can use the Shopify forum. To be franlky honest I don't see why those questions are accepted on Stack when Shopify have a whole forum for developers to discuss coding in liquid specifcally for Shopify.

Add custom fields on adding product in shopify

How to add some extra details while adding products?
Currently I am able to add Variant in Product which shows an input field for the product in product details page. But then, I require to add the same Variants for all products.
My Requirement was to add custom field, e.g. Weight, Height, Wood Type, Color etc. that would appear for all products that are of category Table.
Is this possible some how?
This can be accomplished by creating a new template for your product. You can find some documentation for manually configuration additional product options here.
Most merchants on Shopify use apps to avoid manually configuring additional product options.
A simple task for you would be to add the information using the API for metafields since you are saying they are to be added to all the products. More information on metafields API and liquid are in the links below
Metafield Object and Metafield API
If they are only a few products, you can give this app a spin - ShopifyFD
If the different fields affect the price, create variants. Metafields can also be defined at variant level.
Product metafields can be managed from the Shopify adminpanel directly. You don't need a third-party app or chrome extension anymore!
From the adminpage, go to settings (bottomleft corner) and go to Metafields. From there, you can add the metafields to the product and set the desired contenttype (inputfield, image upload, checkbox, etcetera)
You will need to provide a namespace and key, which you can refer to from the code template. For instance: setting the "namespace and key" field to my_custom_fields.somefield, you will be able to access it from the product template file (product.liquid) like so:
{{ product.metafields.my_custom_fields.somefield }} or, of course, assign it like so:
{% assign myField = product.metafields.my_custom_fields.somefield %}
The created metafields will appear on the product editpage at the bottom. No chrome extensions needed!!
The accurate answer to your question is NO, You can't
But, the good news is there are some apps to accomplish the result. Here is one of the apps which is free!