Phil
(@fullysupportedphil)
Automattic Happiness Engineer
To clarify, is this what you are trying to do:
When a customer adds a specific product variation, you want to then automatically select a matching variation on all other products (based on attribute)?
Or is it something else?
If that’s what you wanted, I don’t think that would be possible. That being said, I’m not a developer myself.
For these type of coding questions, you’re more likely to get input by asking in the WooCommerce Developer Slack or Advanced WooCommerce Facebook group. As those communities are both frequented by developers (including our own).
Thread Starter
Lisa
(@justmontessori)
Thank you for your response. Let me clarify what I would like to know:
1) Can someone point me to the function in WooCommerce that is executed when adding an item to the cart?
2) I want to extract “attribute_style-color” to set in a global cookie that persists in the browser for a period of time.
3) When a visitor displays a page using that browser with the Cookie set, I want to grab the cookie VALUE which is “attribute_style-color=COLOR” and pass it to the drop-down as <option value=”COLOR” selected>COLOR</option>
I know all these can be accomplished easily on their own, but need to know where the function in WooCommerce is to add the code, grab the COLOR in the Cookie, and then assign it to the attribute drop-down? If I add /?attribute_style-color=COLOR to my URL it will already do this.
Hope that was clear… Lisa
Thread Starter
Lisa
(@justmontessori)
Thank you, Phil, for directing me to WooCommerce Developer Slack. I am making good progress, and I think it will be as straightforward as I thought, if one knows the WooCommerce functions.
I’ll post final conclusion once I get everything working…
Thanks again!
Phil
(@fullysupportedphil)
Automattic Happiness Engineer
Glad to hear that’s been a helpful resource @justmontessori
If you do find a solution for what you wanted to do, certainly feel free to update the community here in case someone else has the same need.
Cheers!