I'm really stuck on this and i hope the EE community can help. I have CartThrob using a custom plugin for shipping that sets price thresholds to achieve free shipping. And it seems to be applying the right rate immediately based on the pre-tax subtotal, but a value for selected_shipping_option is not. It is only when I use the cart update form to resubmit the cart contents, which includes the shipping options drop down, that the value of shipping option is being set. I'd like to be able to display some information on the checkout screen on the basis of the selected shipping option, but although the right amount is being applied for the transaction, the value of shipping_option is not being set. Is there anything I can do about that? I don't want to force the user to re-select even the default option just to be abel to get that value recorded and therefore included in the order entry.

So when I first go to my basket and have:

    {exp:cartthrob:update_cart_form return="basket/index" required="shipping_option"}
    <select name="shipping_option">
    <option value="ship_to_my_address" {if '{exp:cartthrob:selected_shipping_option}' == "ship_to_my_address"} selected="selected"{/if}>Ship to my address</option>
    <option value="in_store_pickup" '{exp:cartthrob:selected_shipping_option}' == "in_store_pickup">In store pickup - free</option>
    <input type="submit" value="Update Cart" class="button small" />

Neither option in the select box is being marked as selected and if I simply try putting {exp:cartthrob:selected_shipping_option} in the template, I get no value returned - UNTIL I submit the update cart form - then it works fine. But I need (and would expect) the value to already be set - not JUST for the right amount to be charged.

Anyone have any ideas?

1 Answer 1


Usually this is because {exp:cartthrob:get_shipping_options} loop not setting value for "shipping_option". I'm using something like that (inside update_cart_form):

{if cart_shipping=="0.00"} <input type="hidden" name="shipping_option" value="personal_pick_up"> {/if} {if cart_shipping=="20.00"} <input type="hidden" name="shipping_option" value="overnight"> {/if}

{cart_shipping} can have format like "20.00 $"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.