I’m putting together a store that will have a weekly menu. The thought is you can order for this week’s menu or next week’s menu, that will be a rolling two weeks of items to pick from.
Of course when next week rolls around, that will be the current week and the week after that will be the next week, and so on.
I’m going to handle this with Collections, a collection for each week in the year or simply re-naming 2 collections every week as each week rolls by.
Assuming this is a viable structure, the real question is this: When someone buys an item that was in one of these collections, can I pass that collection name in with the ordered line item so when we fulfill the lines we know what weeks they are for? We could have the same item in both weeks so when someone picks the item we need to know which week (which collection) they wanted it. Does that make sense? Anything else I should be thinking about for something like this?
I think it would be easier if you use metafield, and use date instead. Using the collection would be a little vague to pass to the product since a product can be use in two collections. You can pass information to the product and to the cart buy using the line-items properties.
After a little research I’m thinking I should use a hidden form field in the product page called “menu date” or something like that, and on page load use JS to set the value of that field based on the collection we came from to view that product if that’s even possible. Then that would go into the line item the same as any custom parameter in an order. It may also be that I can’t have the same product in two collections, I’d have to make duplicate products for each weekly menu though that would be a bummer if so. Tough to extrapolate context from the items collection but with two weekly menus out somehow I need to know by line item what weekly menu it came from.
edit- looks like the collection name the user navigated from is available in the breadcrumb menu on the product page. I should be able to grab that collection name and pass it to a hidden field.