Foxy Forum Status

We're no longer responding to questions via our forum, but we will keep it up for historical reasons. If you can't find the answer you're looking for, please visit our knowledge base or contact us. If there's enough interest in the future, we may bring the forum back.

Will Call, Free Pickup

jrwhipjrwhip Member
in Help edited November 2014
I need to add an option for customers to pick up products rathe than have them shipped. I would also like this to change the shipping address to our office. That is currently the method our shipping department uses to determine if a package is to be shipped or picked up.

I can't seem to find any way to do this in the documentation. I did find this article in the forum:
https://forum.foxycart.com/discussion/comment/49384

But I am not entirely sure how they are doing this, and where the code is implemented.
Tagged:
Comments
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    That should be possible to achieve. One question though - how are you approaching shipping otherwise? Are you using live rates, or a flat rate change?
  • We are not using live rates. Right now I have some different rates set up for different categories, but shipping is a problem I am not sure who to address, as the shipping rates change depending on what is in the order, and all orders above $400 include free shipping.
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    What you'd be after to set that up then is the flat rates snippet - if you're on 2.0 you'd use: https://wiki.foxycart.com/v/2.0/snippets/flat_rate_shipping_modification - and if you're on 1.1 or older, you'd use: https://wiki.foxycart.com/snippets/shipping/multiple_flat_rates

    Using that you would build out javascript logic to look what's in the cart and decide on a rate based on that. You could also then provide the free shipping option, and the customer pickup.

    You would then also use javascript, for when the shipping rate is selected - if it's the pickup option, you reset the shipping address to your address. For what it's worth though, that may be an unexpected experience for the customer - and considering the "customer pickup" rate selection is passed with the order, your fulfilment team could work off of that value rather than looking for a certain shipping address.
  • Adam,

    Thanks! I have two questions. First this logic is going to take me a bit to figure out. How would I just add a checkbox or something on the checkout page for pickup that made shipping free?

    Second question: Is it possible to have a test store running along side a live store. There are still a lot of changes I need to make, and I don't want to break anything as I'm doing it.
  • fc_adamfc_adam FoxyCart Team
    edited December 2014
    @jrwhip,

    To set up free shipping when you're using live rates, you need to have the flat rate shipping in your categories set to $0 and everything is calculated in the javascript snippet. We have some protections on the checkout that prevents a flat rate shipping cost being below what the categories deem it should be. You'll need to use the snippet to get that running. If you need a hand getting started we can help you out there.

    Is it possible to have a test store running along side a live store.

    Definitely, simply create a new store and you can test it as much as you need. You only need to pay for a store when you want to accept live payments through it - so if it's just a development store, it's free as long as you need it to be around.
  • Yes, I think I could use some help getting started on that.
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    Could you confirm your store for me please - feel free to whisper if you'd prefer to keep it private.
  • ximo365
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    This should help get you started - it shows you how to approach the two different flat rate types, by shipment and by product. You'll need to duplicate it for your other categories that require flat rate shipping charges:
    var catTransformation = 0;
    var catStandard = 0;
    
    for (var i = 0; i < FC.json.items.length; i++) {
    	switch(FC.json.items[i].category) {
    		case "transformation":
    			catTransformation += FC.json.items[i].quantity;
    			break;
    		case "Standard":
    			catStandard += FC.json.items[i].quantity;
    			break;
    	}
    };
    
    var shippingCost = 0;
    
    if (catTransformation > 0) {
    	// charge per shipment
    	shippingCost += 17.50;
    }
    if (catStandard > 0) { 
    	// charge per product
    	shippingCost += catStandard * 12;
    }
    
    FC.customFlatRates.add(1, shippingCost, '', 'Standard Shipping');
    FC.customFlatRates.add(2, 0, '', "Customer Pickup");
    
  • How do I give customers the option to choose customer pickup?
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    A customer pickup option is added as a rate at the bottom of that script, which the customer will be able to select instead of the standard shipping.
  • I set shipping on each category to flat rate with a value of zero. I then copied the code you provided exactly and placed it in the Add custom header and footer code to your templates footer section.

    It does not work. In fact it prints the code at the bottom of the checkout page.
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    Ah sorry - you'll need to follow the instructions as noted on the page I linked to earlier: https://wiki.foxycart.com/v/2.0/snippets/flat_rate_shipping_modification - the code I provided above is the custom logic as detailed in the instructions, rather than being stand-alone code.
  • Ok that helped. Thanks!

    For products without a category the whole cart seems to fall apart.
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    Could you clarify what the whole cart falling apart looks like? Perhaps a URL I can reproduce it from?
  • Sure thing. All the products on this page do not have a category set, so you can see what I mean by adding one of them to the cart.

    http://www.ximo365.com/product-line
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    Ah - do you mean that it changes the styling on the full page cart? If so - we have a bugfix pending for that which should be launched this week.

    As a work-around for now, you can use this version of the flat rates snippet - just move your custom logic over to this snippet: http://pastie.org/private/r3lju3oxvi5q7cmju1c1q
  • Thank you. That did it. Is there a way to add a default shipping amount if no category is selected?
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    You could set some logic right before the shipping rates are added which checks to see if the shipping cost is 0, and set's it there like this:
    if (shippingCost == 0) {
      shippingCost = 5;
    }
    
  • That would just set a base rate that would then be added to right? It would work the same as if I was to initially declare the value of shippingCost to 5. Is that correct?

    I was wondering if there was a way I could determine if a product was added to the cart which didn't have a category. Something that would fit into this logic
    for (var i = 0; i < FC.json.items.length; i++) {
        switch(FC.json.items[i].category) {
            case "transformation":
                catTransformation += FC.json.items[i].quantity;
                break;
            case "Standard":
                catStandard += FC.json.items[i].quantity;
                break;
        }
        };
    

    Or am I going down the wrong path here?

    Also is there a way I can access the carts subtotal here? I also need to set shipping to free for any order over $400. I am thinking it may be in the FC.json somewhere, something like FC.json.subtotal I have looked around briefly on the wiki, but so far I have not found what it would be.
  • fc_adamfc_adam FoxyCart Team
    edited December 2014
    @jrwhip,

    Not quite. I'm suggesting that you add that after the switch statement and the if conditionals that are adding to the shippingCost - so if the shipping is still $0 after running through all of that, it sets it to a default of $5. If you set the shippingCost variable at the start, that would mean that all rates would be $5 more expensive.

    I was wondering if there was a way I could determine if a product was added to the cart which didn't have a category.

    The product in that instance would have a category of "DEFAULT".

    Also is there a way I can access the carts subtotal here? I also need to set shipping to free for any order over $400. I am thinking it may be in the FC.json somewhere, something like FC.json.subtotal I have looked around briefly on the wiki, but so far I have not found what it would be.

    You'd be after FC.json.total_item_price for the subtotal. You can view all of the values of the json object here: https://wiki.foxycart.com/v/2.0/templates/view_data
  • Ok, yes that makes sense. Thank you so much for your help!
  • Im running into a problem, and possibly a bug with sales tax.

    When you select customer pickup as a shipping option the sales tax changes to zero. Then even if you change to regular shipping the sales tax remains zero.
    http://www.ximo365.com/product-line
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    Could you please whisper me the address you're testing this with? I just tested a US addressed in MN which provided a tax of $12.12 when selecting customer pickup, and when selecting the standard rate, the tax increased to $13.34 as the shipping cost was taxable.
  • I took a few screen shots if you would like I can email them, but I just tried it again with a few addresses and it was working. So hopefully it was just a glitch on my computer, maybe from changing the javascript files so many times.

    Thanks again for all your help.
  • fc_adamfc_adam FoxyCart Team
    @jrwhip,

    If you run into it again, definitely let us know and we'll take another look.
Sign In or Register to comment.