Add custom variable to all orders with default value that will be on subscription renewal orders

Hello,

I'm trying to set a hidden custom variable (num_days_late) on every order (including subscription renewals). I have found I can add to the custom link URL passed to the cart on new orders like this:

"https://armgem.foxycart.com/cart?1:name=TestProduct&1:price=1&1:sub_frequency=1m&h:num_days_late=0"

However I haven't found a way to add this to every order using the "Custom Value" variable and passed to the twig templates for the cart or checkout. Is this possible?

Secondly, once the variable is set is there a way a default value can be set on each subscription renewal order? We are trying to automate a dunning process (using OrderDesk) that sends out different emails dependent on how many days late a subscription is.

Please let us know.
Thanks!
Comments
  • fc_adamfc_adam FoxyCart Team
    @ArmGem,

    Just to clarify - are you basing the number of days late based on how many days since the subscription should have renewed but their payment failed? If so - you could base that simply on the current date and when the last renewal should have been. No need for a custom attribute to manage that.
  • Hi @fc_adam,

    That was our initial thought as well, however we're not sure if we can use expressions in OrderDesk (have a ticket into them to verify) to compare date variables and run rules (dunning emails) based on this. Also it wasn't clear how we can pull a normalized date value via the API (via OrderDesk) which appear they are in the format YYYY-MM-DD HH:MM:SS. Is it not possible to have a custom value retained/set on renewals?

    Thanks!
  • fc_adamfc_adam FoxyCart Team
    @ArmGem,

    You can add a custom session attribute as part of the initial order, but you won't be able to alter it once the order is initially created - it will remain set as it was originally set when the transaction was created, so a custom session attribute won't really be useful for you. So if you set a custom session attribute of "foo=2" on a subscription purchase, that attribute will also be set on every renewal of that subscription as well.

    You can set custom attributes against transactions using the API, you create and update these values yourself as a way to store additional information against transactions - for example it could be used to store the status of a transaction, whether it's been shipped or not, the shipping tracking number, etc.

    For what you're wanting though - you could also set up your own dunning email system that meets exactly what you need using the subscription datafeed: http://wiki.foxycart.com/static/redirect/subscription_datafeed - that will give you information on subscriptions that are past due that you can perform certain actions on.
Sign In or Register to comment.