1

I'm trying to set a custom price for a recurring subscription in CartThrob. I've currently got the following code:

{exp:cartthrob:add_to_cart_form
    return="/become-member/checkout"
    subscription="yes"
    subscription_allow_modification="yes"
    shipping_exempt="yes"
    tax_exempt="yes"
    allow_user_price="yes"
    plan_id="{id}"
    subscription_interval_units="{interval_units}"
    subscription_interval_length="{interval_length}"
    subscription_price="{price}"
  }   
    <input type="hidden" name="price" value="70.00" />
    <input type="hidden" name="subscription_price" value="70.00" />

   ....
  {/exp:cartthrob:add_to_cart_form}

That works fine, it'll set the price of $70.00 as dictated by 'subscription_price'.

My problem is that users are able to add a concession card code to the product in the add to cart form and that will reduce the price to $66.50 (using javascript). Upon checkout this price is saved in the CartThrob order in the CP but the recurring subscription price is still the full $70.00 amount.

Is there a way to set the recurring price to the concession price if it's set in the checkout form or do I need to look into other options?

Thanks in advance!

1 Answer 1

1

Judging by your use of {id}, {interval_units}, and {interval_length} I'm assuming you have all that wrapped in a {exp:cartthrob:plans} tag pair and that you're trying to adjust the price of an existing plan. Here's how you would do that.

{exp:cartthrob:plans}
    {!-- specify the subscription plan id to add the item to the cart --}
    {exp:cartthrob:add_to_cart_form 
         return="become_member/checkout"
         subscription_plan_id="{id}"
         form_class="form-horizontal"
         allow_user_price="yes"
         shipping_exempt="yes"
         tax_exempt="yes"
    }
    <input type="hidden" name="price" value="{price}" /><br />
    ...
    <input type="submit" value="Add plan" />

    {/exp:cartthrob:add_to_cart_form}
{/exp:cartthrob:plans}

All of the other subscription settings (units, length, etc.) will be handled by your plan settings in the subscriptions module.

When you update your price field with javascript and submit that add to cart form, it will apply to your subscription plan price.

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.