Issue with - "Allow customers to purchase this product when it's out of stock"

New Member
18 0 0

Strange thing that I cannot figure out.  Using VENTURE (VERSION 4.0.0)

 

I want our customers to be able to order an item even if it's out of stock.  I've added a custom message for them if the stock count is 0 (basically a note on how long it should be).  However, when the item is in stock (say qty of 20) and the "Allow customers to purchase this product when it's out of stock" is checked it just shows the custom out of stock message and no available stock count.  Uncheck this and it shows the available stock (say qty of 20).  If stock goes to 0 then it does not allow them to order since the check box is not active for out of stock ordering.  

 

I've narrowed down the code section in question, I think.....

 

 

{% if section.settings.stock_enable %}
<li>
<span id="ProductStock-{{ section.id }}" class="product-single__stock {% unless current_variant.inventory_management and current_variant.inventory_quantity < 10 and current_variant.inventory_quantity > 0 or current_variant.inventory_management and current_variant.inventory_quantity <= 0 and current_variant.incoming %} hide{% endunless %}">
{% if current_variant.inventory_management %}
{% if current_variant.inventory_quantity < 10 and current_variant.inventory_quantity > 0 %}
{% assign qty = current_variant.inventory_quantity %}
{{ 'products.product.stock_available' | t: count: qty }}
{% elsif current_variant.inventory_quantity == 0 or current_variant.inventory_quantity < 0 and current_variant.incoming %}
{% if current_variant.available %}
{% assign date = current_variant.next_incoming_date | date: "%B %-d, %Y" %}
{{ 'products.product.will_not_ship_until' | t: date: date }}
{% else %}
{% assign date = current_variant.next_incoming_date | date: "%B %-d, %Y" %}
{{ 'products.product.will_be_in_stock_after' | t: date: date }}
{% endif %}
{% endif %}
{% endif %}
</span>
</li>
{% endif %}
</ul>




{% comment %} Inventory tracking on product page {% endcomment %}
<div id="variant-inventory" class="{% unless current_variant.available %} hide {% endunless %}">
{% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != "continue" %}
{{ current_variant.inventory_quantity }} in stock
{% else %}
This item is currently out of stock<br/>
You can order it now and we'll put you to the front of the line!<br/>
Most out of stock items ship in one week
{% endif %}
</div>

0 Likes
New Member
18 0 0

Here's a screen-cast to show the issue I'm having.

https://screencast-o-matic.com/watch/cqiQFtOlR4

 

This is driving me bonkers!

0 Likes
New Member
18 0 0

Have I stummped the Shopify wizards?????  There's got to be a way to make this work.... I really am hoping there's a way.....

0 Likes
Shopify Staff
Shopify Staff
91 10 17

Hi @Cool_CNC_Stuff,

 

Thank you for getting in touch, and for sharing that video and the code you've been working with.

 

I can see your issue here and believe this is something our theme specialists can assist with to get everything working fully for you. I have gone ahead and sent an email to the email address attached to your forums profile, so please check your inbox and get back to me there. Once you've done that we can look at this in more detail and hopefully help implement a solution for you.

 

Kind regards,

 

Victor | Shopify Social Care

 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
Highlighted
Astronaut
765 80 155

@Cool_CNC_Stuff 

 

This is because of the:

 

{% if current_variant.inventory_management == "shopify" and current_variant.inventory_policy != 'continue' %} 

inventory_management does not equal shopify after you've set it to allow customers to purchase out of stock items. I think the problem is with your logic, I think it should be OR, not AND:

 

{% if current_variant.inventory_management == "shopify" or current_variant.inventory_policy != 'continue' %}

In the previous version with "AND" that means both conditions need to be true, but they can't both be true so it needs to be either or.

 

But I'm not sure that will work the way you want it to either. Why not use current_variant.available?

 

{% if current_variant.available %}
//Add to cart button
{% else %}
//Sorry out of stock
{% endif %}
If you'd like to make any edits to your store, please send me a personal message and we can discuss what you'd like to accomplish :D
0 Likes