Widget width variabel price (Shopify) - html

I’m about to integrate a Santander widget on my Shopify site, but I need to replace data-amount with price variable: https://www.dropbox.com/s/cf025mnb5lr8j9m/satander_widget.jpg?dl=0
I have tried to use data-amount="{{current_variant.price}}"> but nofthing happens.
https://www.dropbox.com/s/oibwr7qrb20xk33/27.06.2022_19.32.43_REC.png?dl=0
Any idea why it do not works? I'm using current_variant.price others places on the product page

current_variant is not a default variable of Shopify. It is something that typicall the theme is setting, somewhere.
You just need to be sure that you're inside the scope of that variable.
Search for current_variant = and you will find where is set, normally this is the value
{%- assign current_variant = product.selected_or_first_available_variant -%}

Related

cant get inside key of an array that is numbers

I have an array that I use to create a table, however, I first need to identify the path.
my Array is saved in:
page.cart.lineitems.elements
this is the output if i dump it:
in these two keys are my table arrays but I can't get inside.
The keys are named after 2 items in a cart where I can identify which one I want to use, so I get the values from a key called:
im saving the value of "_key" here:
{% set articleKey = _key %}
so now I should be able to use the key name as such
page.cart.lineitems.elements.articleKey
instead of page.cart.lineitems.elements.120ac316d177487fa879c51e02845135
inside the articleKey.extensions.TwpSortiment.data is
so I wrote this code but it still doesn't go inside my "articleKey"
<div class="twp-sortiment-form">
{% set articleKey = _key %}
{% for key in page.cart.lineitems.elements.articleKey.extentions.TwpSortiment.data %}
//my table code
{% endfor %}
</div>
whats is the issue? why can I not go inside the articleKey? I tried it even with writing the whole name but an error occurs:
Unexpected token "name" of value "ac316d177487fa879c51e02845135" ("end of statement block" expected).
fixed it by typing the path this way page.cart.lineitems.elements[articleKey]

all_products[] Not working with JSON variable

I am trying to retrieve a metafield with all_products[] but using a locale json file content as the handle.
I have created this value in the en.default.json. If I just use {{'products.product.product_handle' | t}} I receive the proper handle so I know that I'm getting the right information but for whatever reason I can't pass that value into the all_products[] function.
I've tried the following code:
{{all_products[ 'products.product.product_handle' | t ].metafields.my_fields.cardtext}}
and
{% assign text = 'products.product.product_handle' | t %}
{{all_products[text]..metafields.my_fields.cardtext}}
Json Setup:
"product_handle": "{{ handle }}"
Can anyone tell me what I'm missing or if there is another way to display this content?
The first syntax is invalid.
The second syntax is almost valid, you have double dots before metafields => ..metafields
So when you fix the above as long as you are targeting the correct translatable string and metafield it should work:
{% assign text = 'products.product.product_handle' | t %}
{{all_products[text].metafields.my_fields.cardtext}}
You can check if you are getting the product first, for example:
{{all_products[text].id}}
If you are getting the product but not the metafield, then the issue might be in the metafield target.

Change default page names in Bigcartel Theme (Luna)

I would like to change the name of the "products" page into "artworks".
I changed it manually in the theme layout (Luna), but that doesn't work of course for the main page title displayed on the browser tab. I looked around in theme options but can't find a way. Thanks for your help, Giorgio
Go to Design > Code > Products Custom Code
Search for:
{% assign page_name = 'Products' %}
Change to:
{% assign page_name = 'Artworks' %}
Your page's header will change to Artworks along with the browser tab.
See my example here where I have renamed the products page " C A T A L O G "
If I understand your question correctly you might not need to code this bit. Just change the name of the "Products" category to whatever you like.
Go to Design>Code>Products
Don't go into the code - right at the top of the page where the category is titled Products change it to Artworks.

Getting the number of formset's id in Django

In forms.py I have created a formset using formset_factory with extra=6
class Associe(forms.Form):
nom= forms.CharField(max_length=40)
AssocieFormSet=formset_factory(Associe,extra=6)
in my page.html I wrote a loop to write my forms 6 times, but I nead the number in the id, I know Django will give form-0-nom for the first element, and id_form-1-nom for the seconde element and so on, and I know how to get the whole id of the element.
But how can I get only the number of each element's id?
I think an easy way of getting the form number would be by using the template tags forloop.counter0 or forloop.counter. So with forloop.counter0, form-0-nom will have the number 0 within that iteration and you can do what you want with that number.
Django Built In Template Tags

Add custom size fields to product in big cartel

I have an online store on big cartel and some of the products may require an optional field where the user can type in his/her measures so that the product can be specifically designed for him/her. Although I am familiar on how to implement the front-end part of this, I am not quite sure how to make it comfortable for the vendor to have these extra info attached to each product so that when they visualize the order all these extra info are immediately attached to it.
My best case scenario is this:
The user picks a product and selects on the Size drop down choice the "Custom" option. At this point a little form will appear that they can fill with all the custom size they need. Now instead of attaching the string "Custom" to the product summary in the cart, I would like to have whatever they typed attached to it so that in the cart it will look something like:
[ PICTURE OF THE PRODUCT ] : product name - sizes typed by the user
This would make it easier for the vendor to understand what the user wants and will allow the user to purchase an item with custom size instead of the standard ones that might not be suitable for him/her (XS, S, M, L, XL).
Right now the code part that handles the size choice and submits to the cart looks like this:
<form id="product-form" method="post" action="/cart">
{% if product.has_default_option %}
{{ product.option | hidden_option_input }}
{% else %}
<div id="product-options" class="options">
<span>{{ Product_Options_Title }}</span>
{{ product.options_in_stock | options_select }}
</div>
{% endif %}
<button id="product-addtocart" name="submit" type="submit"><span>{{ Add_to_Cart_Text }}</span></button>
</form>
I thinks this is Angular which I am not very familiar with. But I think here is where I should make any change, I am also not very familiar with the big cartel framework, this is why I could use some pointers.
So my question would be, how do I edit the code so that the user can type in custom sizes and then attach what they typed to the product in the cart as the size they ordered ?
I understand my question might not be very clear so feel free to comment for clarifications. Keep also in mind that I would know how to implement the front-end part but I don't know how to interact with the back-end to make what I described happen. Thanks in advance.
Sorry, but something like this isn't possible with Big Cartel - the platform doesn't support passing any additional information through the order process beyond what's already attached to the Product and the Product's Options.
Your best option is likely to instruct customers to add their custom information to the "Notes to seller" field at Checkout: https://blog.bigcartel.com/2014/04/22/introducing-notes-at-checkout/
You can find more information on editing Big Cartel themes here: https://help.bigcartel.com/developers/themes/
Bigcartel now coming with grouped option. It's only active on paid plan. So you can add now size, color, design. Yes, you can add maximum three option variant.