Get active shipping options in Custom Live Rate Endpoint

Hey guys,

I'm working on a store that has a custom live rate endpoint. It's basically a way for me to get rates for multiple packages in the same order (wine). The client wants to be able to control the Shipping Options and get the custom live rates for each. Right now, our custom endpoint only uses Ground shipping, which is functional.

What I need is to find the currently active shipping services to pass to my custom endpoint so I can grab a rate for each. Possible? I couldn't find the data in the FC object at checkout.

Thanks!

-Jacob
Comments
  • fc_adamfc_adam FoxyCart Team
    @jacobdubail,

    When you say you're using the custom live rate endpoint - are you referring to this snippet? https://wiki.foxycart.com/v/2.0/snippets/custom_live_rate_endpoint

    If so - you can add any custom variables you want to pass to your endpoint into the request_data variable. That is passed to your endpoint. You can get information on the currently selected shipping option from the JSON object on the cart/checkout
  • Thanks Adam,

    Yes, that's the snippet I'm using.

    I'm unable to find the selected shipping options in the JSON object. Could you point me in the right direction?
  • @fc_adam, Any update on this? Thanks!
  • fc_adamfc_adam FoxyCart Team
    @jacobdubail,

    Sorry for the delay - I was out the last couple days. You can see the current shipping rate selection in FC.json.shipping_address.shipping_service_id and FC.json.shipping_address.shipping_service_description
  • Thanks @fc_adam,

    That's close, but that only get's me the option that a customer selects at checkout. I need to find all of the available options that have been selected in the Admin. Is this possible?
  • fc_adamfc_adam FoxyCart Team
    @jacobdubail,

    Ah sorry for misunderstanding you. Unfortunately not. You can get all the rates returned to the customer though from the JSON - they're in FC.json.shipping_address.shipping_results
  • @fc_adam,

    Thanks for the quick reply. If I'm using the custom live rate endpoint, that doesn't help much, does it? Basically, I need to be able to send all of the store owner's preferred shipping services to my endpoint to get custom rates for each service (due to the way we're handling packaging). Any workarounds you can think up?
  • fc_adamfc_adam FoxyCart Team
    @jacobdubail - oh right, you're spot on there.

    Unfortunately you don't have access to those details on the checkout.

    Two options. Firstly you could hard-code them in your endpoint. If that's not possible, the only way to get the currently selected rates is by using our new hAPI. Details on that available from http://api.foxycart.com.
  • Thanks @fc_adam,

    I was looking through there, but I can't find which endpoint to use. I was using the explorer and this endpoint: https://api-sandbox.foxycart.com/stores/8 to see what I could dig up, but can only find details about taxes, coupons, gateways, nothing about shipping. Sorry for the hassle, but I need just a bit more hand holding.
  • fc_adamfc_adam FoxyCart Team
    @jacobdubail,

    Sorry for the confusion there, you'll find it under property_helpers.
Sign In or Register to comment.