Sort collections page by Product SKU? - shopify

Is it possible to sort the Collections pages by product SKU (instead of product name, featured, etc)?I have checked the theme's collection-sorting.liquid file, but it doesn't show SKU sorting as an option.

You can manually sort by SKU (use your mouse and drag'n'drop) or if you don't want to manually sort, you can use a script to sort a collection by SKU. It is likely not built-in by Shopify as it is not really something most people would want to do.

Related

How to add different dimensions in product?

Hello Shopify Developers.
I'm a newbie on Shopify. How can we add a tab in product pages as Dimensions? Through this tab, we should be able to edit and change the dimensions for each specific product.
Would you give me a suggestion to do that? please teach me.
Best regards, Siva.
Shopify is not designed to allow customers to enter custom dimensions and have that affect the final price of the item.
However, this can be accomplished in principle through some roundabout steps, which involve a hidden priced product and a fair bit of javascript and the use of line-item properties to link everything together.
If you're feeling ambitious and want to make such a system yourself, the basic flow would be:
Create a product that either has a $0.01 value (or whatever the lowest denomination is in your currency) or a value of whatever the cost-per-smallest-unit that you want to sell by
Update your store templates so that any products that are marked as a component product (via tags, metafields, product type, or whatever you choose to go with) do not get displayed on collection pages, search results, etc.
For your product pages that need custom dimensions, you will need to create any relevant input fields and add whatever formulas you need to convert user inputs into units of your component product
When the item is added to cart, you will need custom javascript to add the correct quantity of the component item at the same time that the main/visible item is added to the cart. At this step, I would recommend adding line-item properties to both items that would identify that they belong together.
You will need to update your cart to hide the component product and add its price to the main/visible item for display purposes, and the quantity-update and item-remove features in your cart to make sure that when the main/visible product is updated or removed the component product is updated appropriately as well.
This can be quite the undertaking to try to take on yourself, so if any of the above steps seem daunting I would strongly recommend looking for an app in Shopify's app store that can do these steps for you. There are a lot of product option/customization apps available, and many of them have free trials that you can take advantage of to see if they meet your needs.
Of course, if you have the skills and ambition to take this project on, great! The above flow should hopefully get you started, and if you need further advice on any specific step feel free to ask another question.

Limit product to only one per customer

I'm trying to code a solution for a client, that doesn't wish to use apps. We need to be able to limit one of our products, so there only can be one of it in cart at a time.
Is there an easy way to achieve this without an app?
I'm fairly known in JS, HTML and basic liquid solutions. Is it possible to create a pure liquid solution or do we need javascript aswell? The store use ajax cart, which we need to keep.
Thank you,
Magnus
Any time you have a call to add to cart, ensure the quantity is 1
Any time you have a call to add to cart, first ensure that item is not in the cart
When you render the cart, take all the inputs for updating the cart away. Allow only delete.
With that, you can hope that for the most part, customers will only ever have one of something in the cart.
You can then focus on removing any ability to change the quantity when adding to cart, and ensuring that when checkout is selected, items do in fact only have a quantity of 1.
No Apps needed.

Displaying First Collection That Was Assigned to Product

I'm trying to change my product breadcrumb to display the first collection of a product (rather than showing the path the user took to reach the product).
I'm using the code product.collections[0] to show the first collection... but this displays the collections in A-Z order rather than the first collection that was added to the product.
Is there a way to call the first collection that was added to the product rather than ordering it A-Z?
Conceptually there is nothing in Shopify to support your cause. If you have a product you can get the list of collections it belongs to, but there is no support for a hierarchy or temporal access time. If you need to keep track of which collections a customer hits per product, you will need to do that yourself, manually, with JS.
Ever since day 0 of Shopify, I am sure there has been a wish for Shopify to somehow keep track of the collection that was selected when a customer selected a product, but to date, even that is not supported at all.

Shopify variable price for a single product

I am about to display a rack builder in my shopify.
The users can set various customization like the number of rows and columns and the size of each cell and its door option for each cell.
The problem is that I would like to know how to enable variable price for that product. I think I cant use variant product as it will be limited in number.
This will require quite a lot of customisation.
First you will need to split your rack elements into separate products:
doors
rows
columns
sizes
You will need to enter variants for each of the different elements.
Once you are done with that you will need to create a page that allows you to customise the product showing the options from the product elements you created above.
You will need to collect the product customisation with JS and add the appropriate amount of each element to the cart.
In case the customer have the option of manual input and the price is changed based on that ( for example the size of the wood ) then the functionality will become even more complex.
Long story short it will be hard to code, the administration will be complex and the user experience won't be nice.
Another way will be to look into some APP that can help you with this, but I'm not sure if there is one that has this kind of functionality.

Ordering products by product type in Shopify

I've been asked by a client is it possible for them to be able to manually order product(Types) on the front-end instead of using the default A-Z option.
For example:
Customer visits product listing page
Selects product type from the filterable options E.G "t-shirts"
Products show based on that query but are organised how they have defined possibly in the backend somewhere, or as a Shopify setting that I setup.
I can't seem to find anything from digging around on the internet and I can't think how I'd do this on my own but wondered if anyone else ha had experience or ideas for how this could be achieved.
You could define a collection with the condition "Product type is equal to your_type". Then after you save the collection you can choose to order the products manually (the default is alphabetically).