Make some variants special order

sjtrials
New Member
5 0 0

Hi 

So, I sell many different items.

One item has 6 variations, 3 of the variations I keep in stock at all times, the other 3 are special order.

When someone selects one of the three variants that I don't keep in stock at all times I would like them to see a message saying- "special order usually dispatches within 2-3 days"

Is this possible?

 

Is it also possible to apply "continue selling when out of stock" to some of the variants, but not all of them?

 

Thanks for any help possible.

0 Likes

Hello @sjtrials ,

In your product.template.liquid you could add something like this:

{% assign current_variant = product.selected_or_first_available_variant %}
{% if current_variant.inventory_quantity < 1 %}
<p>special order usually dispatches within 2-3 days}</p>
{% endif %}

If the variant inventory quantity is less than one it will show the message.

Startup Slang | Shopify Partners | Lead Shopify Developer
- Was my reply helpful? Please Like and Accept Solution.
- Feel free to contact us info@startupslang.com
0 Likes
sjtrials
New Member
5 0 0
Thanks!
Question, would this apply to every single item on the website then, as
some items I do want to show as out of stock because the lead time to
replace them is much greater.
0 Likes

yes @sjtrials it will apply to all the products. 

If you can identify the products ( for example by type, collection,..) you can add another condition so the inventory rule only applies to the matched products. 

Hope it helps. 

Startup Slang | Shopify Partners | Lead Shopify Developer
- Was my reply helpful? Please Like and Accept Solution.
- Feel free to contact us info@startupslang.com
0 Likes
sjtrials
New Member
5 0 0
Hi @Jorge_Mosquera could you provide the condition that would allow me to
do that?
Thanks for your help with this!
0 Likes

Hello @sjtrials depends on the property you want to use to identify the products.

For example if you want to apply the inventory rule to the products of type "shoes", you can do something like this:

{% if product.type == 'Shoes' or product.type == 'shoes' %}
    {% assign current_variant = product.selected_or_first_available_variant %}
    {% if current_variant.inventory_quantity < 1 %}
           <p>special order usually dispatches within 2-3 days}</p>
    {% endif %}
{% endif %}
Startup Slang | Shopify Partners | Lead Shopify Developer
- Was my reply helpful? Please Like and Accept Solution.
- Feel free to contact us info@startupslang.com
0 Likes
sjtrials
New Member
5 0 0

Hi @Jorge_Mosquera

I have got this added into my template and it is looking exactly as I want it, one small thing though.

If I have some stock of one the items, so say size 6 shoes are in stock and size 7 aren't, I want the text to only show if size 7 is chosen from the drop down menu.

At the moment the text is showing whether the item is in stock or not.

I appreciate your help with this.

0 Likes

Hi @sjtrials,

I'm glad you got it working. I'm assuming the problem you are seeing is when, for example, the page loads in size 7 (with no stock), so the text is showing ant then you change from size 7 to size 6, and then text still there. Am I correct? If this is the case, the code you added is server side, meaning that it is only applied at page loading. In order to hide the text when you change to other variant, you'll need to add some javascript code and it depends on the theme you are working right now. 

Startup Slang | Shopify Partners | Lead Shopify Developer
- Was my reply helpful? Please Like and Accept Solution.
- Feel free to contact us info@startupslang.com
0 Likes
sjtrials
New Member
5 0 0
Hi , that's correct. If a variant is in stock I do not want the text to
show.
The theme I am using is venture.
0 Likes

hey @sjtrials,

I checked Venture theme, and if you are comfortable with javascript you can modify theme.js to hide the text when the variant changes.

look for _updateVariantChange. In this function you can add some code to first check the product type and then check the inventory. 

 

Startup Slang | Shopify Partners | Lead Shopify Developer
- Was my reply helpful? Please Like and Accept Solution.
- Feel free to contact us info@startupslang.com
0 Likes