Shopify themes, liquid, logos, and UX
I have a product which has three variants. The option is `size`, and the three variants of this size option are `4`, `6` & `8`. On product page load the value of `product.selected_or_first_available_variant` is set to the `4` variant, presumably because this is the first variants listed in the product variant's table in admin. I want the product to load on the `6` variant. But I do not want to change the order of the variants in the admin product variants table as this will have other undesired effects also (changing order of variant selector option values in UI).
How can I load this product so that it by default renders my `6` variant, as well as all of it's attributes (price, stock) and images etc?
Hi @jbk1,
Do you want to customize it for a single product, or for all products?
And your product has only 1 option or will there be some with 2 options.
This is going to be a very complicated change so I need confirmation so I can give you the ultimate solution.
Hope it helps!
Hi LitExtension,
I would like to be able to be able to select a default variant to show on product page load for all of my products which have an option and have variants. Currently some of my products have zero options, and the others have only 1 option (set size), this may change in future. For my products which do have an option, they only have that one option, and that one option has three variations (`4`, `6` & `8`). Hope this helps clarify the cases.
Thanks in advance for your help.
Hi @jbk1,
You can't choose the default variant to show on the product page, it will show the first variant.
If the values change in the future, this will not be possible.
If the options are assigned static, you can create a new template for the products and reconfigure everything, but it will be difficult to detail.
Do you know about coding? You can use 'product.variants[1]' it will help you to call 2nd variants of product.
Hope it helps!
ok, so just 'hardcode' the desired variant from the product.variants array then?
(yes, I can adjust the .liquid without too much difficulty)
Hi @jbk1,
It's going to be a complicated tutorial with lots of steps, I can only suggest it for you.
- First, you need to create a new template for the products that need to display the 2nd variant
- For price you need to add condition by handle to show 2nd variant price. https://i.imgur.com/wEnK951.png
- For other information you need to check it in sections/main-product.liquid file and add conditions to everything.
Or if it's too complicated, I recommend you hire a professional, they will help you set everything up quickly. Refer https://community.shopify.com/c/Shopify-Ecommerce-Jobs/bd-p/shopify-job-board
If it helped you solve your issue, please mark it as a solution. Thank you and good luck.
Also if you don't know coding -> You can re order the variants in the product settings and make sure the option you want as default is first. Heres a pic of my store so you know where you go to order them.
I've been wanting to do this too and it would be great if Shopify would introduce a default variant feature in the backend.
Example: Shopify Shop has T-shirts in Sizes S,M,L,XL,XXL. If the customer clicks on a product, they will be presented with the first variant. How many customers actually want a small T-shirt? Almost any product that has sizes will have a somewhat Gaussian distribution to the sizes required, yet by ordering the variants by size means that any user that opens the product, and is presented with the first variant, will be presented with a variant which is in one of the tails of the distribution. It makes very little sense and leads to problems.
Listen to this please. If the first variant (xtra-small) is out of stock the customer gets an immediate "Not Available" message when traveling from the thumbnail to the product page. It makes sense for xtra-small to be first on the size list, but not the default selection. Thank you.
Hi,
While a default variant would get around your issue, if you are able and confident to edit the website code yourself, you can get around the specific issue that you have by using the following variable: selected_or_first_available_variant
Regards
We recently spoke with Zopi developers @Zopi about how dropshipping businesses can enha...
By JasonH Oct 23, 2024A big shout out to all of the merchants who participated in our AMA with 2H Media: Holi...
By Jacqui Oct 21, 2024We want to take a moment to celebrate the incredible ways you all engage with the Shopi...
By JasonH Oct 15, 2024