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.

passing variable to checkout (member logged in), free shipping option not showing

OliOli Member
in Help edited July 2009
Hey guys,

I need to figure out a solution asap for letting the checkout know that an order is placed by a logged in MODx WebUser (Wine Club Member), enabling free shipping on these qualifying orders. My client is getting irate (

Currently I have a custom field called membership added to product links with the value Pyramid_Wine_Clue (for when a member is logged) and this is toggling a custom message. This is a messy solution as a cart may contain mixed values, plus the check fails completely if the user does not place any further items in the cart after logging in.

The current header message was temporary. Ideally, we'd like to toggle free shipping on orders of 12 bottles or more as per this discussion That said I have been unable to get free shipping to display as a shipping option on the checkout pages (see pics).

How can I go about passing a variable on checkout to the checkout page that is accessible via javascript (jQuery)? or what would be the best way to resolve these issues? (I was thinking of using a cookie, but I don't think that can work across domains).

Note: the site was built with MODx. login/register stuff is handled by the WebLoginPE snippet.

Last, could you please help me resolve: "free shipping" not being displayed as a shipping option.


P.S. my client is also quite concerned me about getting account specific rates through FedEx, as local orders now show a shipping quote that is 4-5 times what they should be. (UPS is not an option for them as shipping alcohol in Canada is a sensitive matter, and FedEx is the only carrier that has the guts to really). Note: this would be less of a priority if we could get free shipping enabled for their members, as the inflated shipping quote could be used help promote signing up for their wine club.

Any help is greatly appreciated. You guys rock. Someday, I'm sure we'll get "super" everything with Foxy modules for all our favorite CMS's.
  • lukeluke FoxyCart Team
    Hey Oli.

    In answer to your question about passing in values to the checkout, just use the hidden fields option (or session attributes) and prefix it with h: in your add to cart links as described here:

    As for free ground not working, it seems to be working now. Did you change anything?

    Once you pass in session attribute to the cart, it should be pretty straightforward to look for it and show/hide the free shipping based on that value using some JavaScript.

    As it relates to custom FedEx rates, do you have your client's developer key, security code, account number and meter number? We've asked others for these values in the past so we could test a full integration with FedEx and we have yet to get a response. When we talked directly with FedEx about this asking if all of these values are required, they said yes and they have to match eachother. UPS makes it much simpler in that we connect with our developer information and just send in a specific account number to get rates as that account. If you could provide some information here, we might be able to do some testing for you specifically.
  • OliOli Member
    edited July 2009
    Luke, thank you for the quick response. I m already using this method of passing a variable with cart links (the variable is being hid manually). 

    "This is a messy solution as a cart may contain mixed values, plus the check fails completely if the user does not place any further items in the cart after logging in."  

     My client has found this solution inadequate, receiving numerous complaints from their customers.

    How can I instead pass a variable on checkout? (opposed to on "add to cart")

    Regarding the free shipping method, I have never been able to see this displayed on the checkout (just checked again on 3 computers including my iPhone, no dice) neither has anyone else I've checked with (All these people are located inside BC, Canada). 

    It's disconcerting that you are able to see this option. What is being displayed to customers?

    P.s. I will request the fedex account credentials you specified and follow up when they reply.
  • lukeluke FoxyCart Team
    Thanks for clarifying Oli.

    It appears we have a bug in how our "free shipping" custom option is setup. It's configured for "Domestic Only" to ensure someone form another country could not use it, but unfortunately that is not working correctly for countries other than the US. We'll look into this over the weekend and figure out what can be done to fix it.

    As for authenticated users, are you using our Single Sign On feature? What you're describing sounds like it would handle it better for you. I understand now that you're only passing in the "yes, I'm an authenticated user" token after they login and so that makes sense.

    Something you may not be aware of is that you can pass in hidden variables with the h: at any time, including on a view cart link. We added this in our most recent version and may need to update our documentation. If you simply add that to all of your cart links, that might give you just what you need (once we get the free shipping option fixed).
  • OliOli Member
    edited July 2009
    It would be excellent to get the "free shipping" option working. Thanks for looking into this.

    I noticed the new :h attribute but would like to get away from passing this variable on "add to cart." with this method a cart may contain mixed values [of the "is member" variable] , plus the check fails completely if the user does not place any further items in the cart after logging in."  

    Is it possible to use SSO to pass a variable on clicking "checkout" (opposed to on "add to cart")? 

    When I checked the SSO API, it seemed considerably complex to implement and geared for something like FoxyBack. That said I would greatly interested in this type of user account integration, especially with MODx. 
  • brettbrett FoxyCart Team
    Hi Oli. I'll try to help clarify the SSO and what (I think) Luke is thinking.

    First, the h: variable can be passed in at any time, regardless of any add-to-cart action. So you could conceivably do this on the checkout or wherever you'd like (like _on_ the cart load, and not on the cart _add_). What you'd do is check the JSON for the appropriate criteria and then, via AJAX or JSONP (JSONP, more likely), send the h: variable silently and in the background. If necessary you might need to immediately force a refresh of the page.

    For what you're describing, I think what you'd want to do is do a JSONP call to add that h:membership value on login (and wherever else is necessary). The only tricky thing might be matching the session values. If you do move in this direction I'll help you make sure you keep the session correct as you make the call.

    That said, SSO does perhaps seems like the more robust solution (and it sounds like you're looking for robustness). It's basically a pre-checkout check, and you could probably implement it without going full out:

    - Enable SSO.
    - Create a basic endpoint in MODx (document with snippet, uncached).
    - The snippet would check for the user's currently logged in status. This should be fairly trivial with the MODx API.
    - If logged in, send a request (CURL) to your cart adding the h: value to their session.
    - Else, don't, and send them on to checkout as anonymous.

    While not necessary, we have discussed the possibility of adding the concept of customer groups in FoxyCart itself. This would be useful for situations like free shipping to members, tax-exempt status, etc. It hasn't been a huge priority because there are workaround, and now with SSO and the user API it's even more flexible.

    Anyway, does that help at all? I do apologize if I've missed the point.
  • lukeluke FoxyCart Team
    Oli, the "free shipping" custom option should now show up as expected.

    Since we don't yet support Royal Mail or Canada Post, "international" for some of our rate request systems means "non-US". This is something we'll be adjusting in the future but at least now the custom shipping options show up as expected for "domestic" rate requests even if the country is not the US.

    Thanks for pointing out the bug so we can improve FoxyCart for everyone.
  • Hi Luke,

    I'm also not able to get "Free Shipping" to show up. I also live in Canada, although unlike Oli, i'm not using FedEx but instead the "Custom Shipping" method. You mention above that there should now be an "international" shipping option? This, i don't see. Any help?

    And out of curiosity, would free shipping only be allowed if the user enters a "suitable" shipping address, or would it show up regardless of the address, based soley on my settings for total sales/quantity?

    FYI, i'm using the latest script from this page:

  • Thanks, Oli! It does come up now -- i see it, but only if I select "ship using live rates". Free shipping doesn't appear as an option if i'm using "ship using a flat rate fee", but i suspect this is an issue for another thread. Thanks for your help!
  • OliOli Member
    edited July 2009
    Luke & Brett, thank you for getting the domestic "free shipping" option working for stores outside the US. This is very helpful !!

    Sadly, my client just got dropped from FedEx, and we are now having a similar issue getting DHL to work:

    *integration between SSO and MODx users will have to wait for another day.

    **the h: session variable and JSON cart object are sOo slick! :)
Sign In or Register to comment.