Multiple Parent and Child Products with limits

bewsterbewster Member
I'm needing the following and wondering if foxycart can do this. I've done some sample setups but can't get it to perform how I need to. Selling individual items is pretty straight forward. The following is my scenario.

I sell boxes of cookies but each box can be custom built. For instance I sell cookies in 12, 24, and 36 counts. In each box you can choose from over a dozen different options (sugar, chocolate chip, peanut butter, etc) up to the box size they choose (12,24, or 36).

A person may buy 2 12-count boxes or 1 12-count and 1 24-count boxes. Each box can have different types of cookies.

Any suggestions, blogs, or tutorials related to this?
  • fc_adamfc_adam FoxyCart Team

    Good question!

    There are a couple different ways you could approach this - but you'd essentially be using our product bundling functionality to achieve it.

    If you have a single page where customers can build out a box - you could let them create a single box as part of a single add to cart. If they select a 12 count box, allow them to select the different flavours they want to include up to that limit. In the add to cart form you'd set up a parent product as the box size, and then child products linked to the parent using the parent_code attribute. When added to the cart, the child products wouldn't be editable, the customer would need to remove that box and add a new one to the cart from your site, but they could order multiples of that box. To allow a customer to add multiple boxes of the same size with different contents, you would also need to dynamically set the parent code to be a unique string for each add to cart, to ensure that the boxes aren't joined together.

    We helped a user with a similar set up just recently - if you wanted to take this approach we could share some javascript with you for that.

    On the more advanced end, you could also allow the customer to build out the box on demand in the cart - also allowing them to make changes in the cart. This would require some decent custom coding, as there are a few aspects to it and we don't currently support total quantity limits for product bundles. We can provide some more specific advice if you're interested in taking this approach - but you would essentially be using javascript to add in some custom validations on the cart and checkout. The validations would look at each parent product, and calculate the total quantity of child products present, working out if it's a complete box or not. If you detect any that aren't complete, you could show warnings and prevent a checkout from happening. You could also prevent a quantity change in the cart if it would exceed the box limit.

    On your own site, you could dynamically show the different boxes the customer has in their cart, allowing them to add additional products into them as desired - only showing those that still have room available.

    Both approaches would allow you to have bundles of products in the cart - but both have a bit of a different experience for the customer. The first approach would be simpler in execution, but the latter does provide perhaps more flexibility for the customer. If you'd like any additional details on either approach, let us know and we'll do our best to help out.
Sign In or Register to comment.