Displaying First Collection That Was Assigned to Product - shopify

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.

Related

Reset product quantities in shopping lists after order placed

I want to know if it is possible to automatically reset the product quantities in shopping lists after customer places the order?
Not the order, but the shopping list itself.
Eg. Change from 5 back to 1?
You can implement it as a part of the custom checkout workflow based on one of the default workflows. For more details the documentation.
For example, that change can be a workflow action described in the last workflow transition definition and executed when the order is created.

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.

Shopify not showing collections for product tagging

For some reason my collections are not showing when I am creating a product.
I have created collections and made them available but why oh why are they not showing up. When i search for them next to the product? I have made the collections arable but only one there is home page?
Shopify has manual collections and Automated collections, Automated collections are those which will add products based on a condition, see on your screenshot how it says product conditions?
You can not add product manually to an Automated collection, it can only be done by making sure the product meets the condition. Hence, Shopify won't show those collections in the collection picker 'cuz that will be manually adding a product to an Automated collection, for example, add straps tag to a product and it will be atomically added to the Watch Straps collection.

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).

Is there a way to tag or identify specific orders?

Using the webhook api to retrieve orders, I'm wondering if there's some way that the orders can be tagged in some form so I can attribute them to certain objects in a shopify app. The scenario is a client wishes to be able to attribute certain orders to different charities. Is there a way they can identify the orders as such?
One thing I can think of is the visitor chooses a "product" which simply dictates which charity they wish the order sale to be donated to, and I look for that product in the webhook. But i wonder if there's another way.
You could use a cart.note or cart.attributes. They allow you to store custom properties with your order.
If you need a per product attribute, you can use Line Item Properties.