• Resolved Lisa

    (@justmontessori)


    I am building a WooCommerce site for purchase of cabinets. Each cabinet has two attributes, “Style/Color” and “Size.” I’ll try to explain my needs clearly.

    Customers buying cabinets for kitchen or bathroom will usually stick to the same color. I want to make it convenient for them to not have to select the color for every cabinet.

    Once someone chooses a Style/Color and Size from the drop-down and adds the product to the cart, I assume they will continue to select other cabinets wanting the same color. So, I want to do set a cookie that carries from page to page and automatically sets the OPTION VALUE in the dropdown to that color (so they don’t have to keep selecting the Style/Color option).

    If they DO happen to select another color for some reason, then the cookie gets reset to that color and the next cabinet they choose will now have the OPTION VALUE updated with that new Style/Color.

    What is the code for doing this, and where would it go?

    LONG VERSION
    1) Set initial cookie upon adding first item to cart (reasoning: customer committed enough to Style/Color to start buying process)
    2) If cookie exists, set OPTION VALUE in dropdown to that Style/Color for every page where Style/Color VALUE exists (reasoning: customer will select cabinets with same Style/Color for whole kitchen)
    3) Only update color if another item is added to cart with a different Style/Color (reasoning: customer either made a mistake or is selecting new Style/Color for other room)

    SHORT VERSION
    Need dropdown value of attribute to automatically be Style/Color (like Shaker Cinder) set in cookie when item is added to cart. The only time Style/Color would change is if customer added item to cart with a different color. Cookie needn’t expire.

    If there is already a way to do this, please advise. If not, please help!

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Hi @justmontessori,

    That’s a fascinating idea. There are a couple of ways you could do this without having to code a custom solution.

    Option One: Utilize Archives
    My wife has a cabinet business as well. She uses a separate category for each cabinet color, though you could use an attribute as well. The advantage of using this method is WooCommerce will generate archives with all of the products in that category or attribute.

    That way the customer can see only products that are in that color unless they leave the category. Instead of listing products on the shop page, she shows categories to make it cleaner for customers.

    Option Two: Filter Plugin
    Another option would be to use a filtering plugin like WooCommerce Product Search. It adds ways for your visitors to be able to select a color and then see all the products that match that color.

    You would still need to add attributes or categories to the products, but customers could easily find the cabinets with the right color and switch colors if they want to.

    I would take a look at those options before diving into custom coding. If you have any questions, please let us know.

    Thanks!

    Thread Starter Lisa

    (@justmontessori)

    Hmmm, not sure I understand the “archives” part of your explanation. I am using categories based on the cabinets (base, vanity, etc.) and door style (framed vs. frameless), however to do it by color, it seems I would have to duplicate the cabinets in each color instead of having all colors as an attribute for each cabinet.

    Anyway, thank you, but I feel like to have a cookie “set” the OPTION VALUE in each dropdown as a customer navigate the site is the direction I’d like to go.

    Appreciate the alternatives, though, and maybe you can explain the “archives” in a little more depth, or point me to documentation? If you want? No worries, if not.

    Thanks again!

    Hey @justmontessori,

    Sorry for not making what I had in mind more clear. Let’s try again.

    What I was attempting to say is WooCommerce automatically generates archives, lists that have all the products in that category, or with a given attribute. You could then direct customers to select a category or attribute and therefore show them all the matching products at one time.

    Looking at your site more closely I see that’s not going to work with how you have things structured. You can absolutely use colors for variations, but it does make finding/purchasing multiple products with the same color trickier. There is a filter widget for attributes, but it won’t preselect the exact color variation. It’ll only show what products have that attribute.

    It is possible to preselect variations by adding the appropriate attributes to the end of the product’s URL. Something like this:

    
    /?attribute_style-color=Torrance+Dove
    

    That would give us a full URL like this:

    https://tcckitchencabinets.com/showroom/12-double-door-stacker-wall-cabinets/?attribute_style-color=Torrance+Dove

    When you visit a URL like that, it will already select the Torrance Dove color variation.

    What you could create is a series of checkboxes that will let the customer pick a color and then that color will be applied to all products by utilizing this URL structure. It could be passed via a cookie.

    Creating that will take a fair amount of work. If you’d rather hire someone to create that for you, you could hire a developer at Codeable to put this together for you.

    Let me know if you have any questions.

    Cheers

    Hello @justmontessori,

    It’s been a while since we heard from you, so I’m marking this thread resolved. Hopefully, you’ve been able to find a way to make this work. If you have any other questions, please open up a new post and we’ll be happy to help you out.

    Take care

    Thread Starter Lisa

    (@justmontessori)

    Thank you 3 Sons, you hit the right idea adding the attribute to the URL. Now, I just need to know how to add this to a global cookie, so it automatically sets the attribute_style-color=[STORED COLOR ADDED TO CART].

    I guess this thread is closed so may not find out here. Wow, only a week went by and the thread is closed. Yikes! <smile>

    Hey @justmontessori,

    That does sound like a promising direction for you. Creating this will take a developer a fair amount of work. They’ll have to set up a widget or shortcode that has the list of attributes with checkboxes. Then they’ll need to create some JavaScript to generate a cookie and read any attributes saved in it. They’ll also have to create a script that adds the selected attribute to the URL of the product pages to pre-select that color.

    Given the amount of work involved, it will most likely take hiring someone to create this for you. It would be unlikely to have someone make it for free.

    I would suggest getting in touch with a freelance developer at Codeable. They can give you a quote on what it would cost to implement a system like this and then build it for you.

    https://woocommerce.com/codeable/

    I hope that gets you pointed in the direction of a solution ??

    Thread Starter Lisa

    (@justmontessori)

    Thanks Three Sons, I am making progress using built-in WooCommerce session variables. I’m not there yet, but will post everything back here when it’s working, then everyone can see how.

    Plugin Support Tseten a11n

    (@tibetanitech)

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Hi Lisa @justmontessori

    I’m wondering if you managed to find a solution to this? I have the exact same need but haven’t been able to work out how to do it, if you managed to solve this, I’d be super grateful to hear how you managed it.

    Thanks

    Dave

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to set a custom cookie that carries attribute selection from page to page?’ is closed to new replies.