Trying to customize {{ continue_url }} on receipt page.

Hi FC,

I need to customize {{ continue_url }} that appears on the receipt page. Specifically, I'd like to append it with a code from FC.json.custom_fields.MYFIELD.value.

I thought this would work:

var FC = FC || {};
FC.onLoad = function () {
FC.client.on('ready.done', function () {
FC.json.continue_url = '';

So, the only choice (unless I decide to modify rendered DOM HREF attribute directly) is to tweak '' which I cannot find :-)

What would you suggest?

  • fc_adamfc_adam FoxyCart Team

    On the FoxyCart cart, checkout and receipt templates - you don't need to wrap the event code in an onLoad() function call - that's just for code on your own website.

    For editing the continue_url, I'd recommend approaching that with Twig:
    {% set continue_url = "" %}
    You can include that right at the top of your receipt template to change that value.

    For accessing the custom value in Twig, you can do that like this, assuming a custom field of "my_custom_field=true"
    {% if custom_fields.my_custom_field.value == true %}
    {% set continue_url = "" %}
    {% endif %}
  • Too bad this does not work:
    FC.client.request('https://'+FC.settings.storedomain+'/cart?continue_url=' + FC.session.get())
    "continue_url" is ignored... :(
  • temuri416temuri416 Member
    edited February 2017

    How do I pass value from FC.json.custom_fields to twig world?

    This does not work:
    {% set continue_url = custom_fields.url_continue.value %}
  • Never mind... That worked.

    But what I could not achieve is string concatenation:

    {% set continue_url = custom_fields.url_continue.value + '/' + custom_fields.order_id.value %}
  • fc_adamfc_adam FoxyCart Team

    You're very close there! In Twig, you concatenate with the ~ character - so it would be:
    {% set continue_url = custom_fields.url_continue.value ~ '/' ~ custom_fields.order_id.value %}
Sign In or Register to comment.