Liquid, JavaScript, themes, sales channels
Hello! 🙂
I have a few simple lines of code on the product page that show two texts based on if a product is in stock or not. If a product is in stock it shows a delivery time of 1-2 days and if it is not it shows 2-5 days. For products that have delays and can first be delivered in future months I use an app called Pre-Order Now. This app allows me to display shipping information text on the product page as well, just for months instead of days.
Here is the problem: when a product is active in the app both shipping texts display at the same time. (For example both 2-5 days text and delivery in september text, see attached image) I need a simple if statement so that the shipping information based on stock levels only executes if the app text is not active on a product.
How could I achieve this? Is there a way to make an if statement based on if a HTML class is active on the page? This way only execute the code if that class is lacking?
This is the code for the stock based shipping text:
{% if product.variants.first.inventory_quantity > 0 %}
<div class="custom-on-stock-text">På lager: 1-2 hverdage</div>
{% else %}
<div class="custom-not-in-stock-text">Fjernlager: 2-5 hverdage*</div>
{% endif %}
Thank you!
It won't be done with the command, you need to contact app.
Because app will work on its own, you can't if/else it with liquid statements, you need to contact app, they will send you separate commands.
Hope it helps!
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024