The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Flat Fee / Setup Charge on Products

We are adding custom die casting to our website, and the industry standard is to have a one-time die charge, plus a per-unit cost. So if you were ordering 1000 die cast badges, the cost would be something like: ($5 x 1000 pcs) + $200 die charge.

Is there a product parameter for a flat fee that doesn't change based on the quantity of items? I feel like this feature is somewhere in Foxycart, but for the life of me I couldn't find it in the cheat sheet or elsewhere.
  • fc_adamfc_adam FoxyCart Team
    edited May 2018

    Good question. We do have a bundled product set up, which can be used to tie two products together in the cart.

    We currently have two different approaches for our bundled products - one where the products are locked to each other, so one can't be removed without the other, and the child products inventory is not editable, instead tied to the parent products quantity. The other approach has the products grouped together still, but the child products can set their quantities and be removed independently of the parent, but removing the parent will remove the children at the same time.

    For what you need, you could take the second approach - and have the one-time fee as the parent product. Visually it would probably make more sense to have the die cast product as the parent - but with the existing functionality, to ensure the customer can't remove the fee independently of the product, it will need to be the parent.

    As an example, an add to cart URL for that approach could look like this:

    You can see that the parent is given a code, and the child specifies that as the parent_code attribute. The child product also specifies the quantity_min attribute of 0 to signify that the inventories are not linked, allowing the child product's quantity to be changed independently.

    Does that sound like it would cover what you're after?
  • This looked like it would work perfect for me - until I hit a snag. There is actually a minimum quantity of 100 pieces for die cast orders. If I set the quantity_min to 0, it works just as you described, but setting the minimum quantity to 100 pieces means that the quantity can only be increased if the quantity of die charges is increased.
  • fc_adamfc_adam FoxyCart Team

    Ah - that is indeed a snag!

    One approach that comes to mind would be to leave the quantity_min attribute as 0, and then add in some javascript validation to the cart/checkout to ensure the customer isn't able to specify an amount below the minimum.

    I've just worked up a quick example of what that could look like - that code could look like this:
    FC.client.on("cart-item-quantity-update", function(params) {
    var min_quantity = -1;
    var new_quantity = parseInt(params.quantity);
    for (var i = 0; i < FC.json.items.length; i++) {
    if (FC.json.items[i].id == {
    for (var o = 0; o < FC.json.items[i].options.length; o++) {
    if (FC.json.items[i].options[o].class == "min_quantity") {
    min_quantity = parseInt(FC.json.items[i].options[o].value);
    if (new_quantity > 0 && new_quantity < min_quantity) {
    alert("A minimum of " + min_quantity + " is required for this product");
    params.quantity = min_quantity;
    You can add that code into the "footer" textarea of the "Add custom header and footer code to your templates" option found on the "configuration" page of your store's Foxy administration.

    The code works by looking for any products that have a custom "min_quantity" attribute included in it. For your products, this would work by adding &min_quantity=100&quantity=100 to a URL, or to a form, adding:
    <input type="hidden" name="min_quantity" value="100">
    Note that you'll still need to maintain the quantity_min=0 attribute too on your second product.

    As long as you're adding that min_quantity attribute though, it should catch a customer trying to change a products quantity to be lower than that minimum within the cart.

    It also assumes that you're not allowing a customer to add the product to the cart with less than that minimum too - is that the case?
Sign In or Register to comment.