Closed na86 closed 8 years ago
Hey @na86 - you'll need to either use paginate
or get
to retrieve the current product list (limiting your results to 1), then use a for
loop on the result so you have a product
variable to use. Something like this should work:
{% get products from products.current limit: 1 %}
{% for product in products %}
<div>
<h1>{{ product.name }}</h1>
<p>{{ product.description | paragraphs }}</p>
<form method="post" action="/cart">
{% if product.has_default_option %}
{{ product.option | hidden_option_input }}
{% else %}
{{ product.options_in_stock | options_select }}
{% endif %}
<button name="submit" type="submit">Add to Cart</button>
</form>
</div>
{% endfor %}
{% endget %}
Hi @nickendle, thanks a lot for your answer! it works fine even with a flickity carousel inside! 💃
I'll take the opportunity to ask you if there's a way to update the price (when quantity is >1) without refresh the page!
thank you! na86
There's not any kind of built-in feature to have the price automatically update when you change the quantity, but you'll likely want to use some javascript that takes the selected quantity and multiplies it by the {{ product.price }}
variable. For more theme and coding info that isn't specific to Dugway, we've got some great resources available:
Themes documentation: https://help.bigcartel.com/developers/themes/ Publicly available theme code on GitHub: https://github.com/bigcartel-themes
http://stackoverflow.com is also great Q&A resource for programming as well. Hope that helps!
it really helped me! Tnx @nickendle
Hi, i'm working locally with Dugway. it's connected to my BC account and it works fine but i wonder how to create a single page shop with 1 product and purchase button.
I'm trying to paste the code from single product template to home page template but it won't work, the page return the following error:
Liquid error: undefined method
[]' for nil:NilClass`Any help would be apprecciated!
thanks guys
Nan