Checkout Form Customisation

I have two different checkout registration forms for different priced products. I am updating the layout in settings -> system pages -> checkout

So I want to use liquid to show the appropriate form and have tried a few variations but can’t seem to get it working. At the moment I have the following which I have got to work in the past in workflow emails -

{% if this.order.totalPriceHtml > 1000 %}
{% component type: "form", alias: "form1" %}
{% else %}
{% component type: "form", alias: "form2" %}

Is the .order.totalPriceHtml not available in the checkout page?

The order object is returned on a form submission, so that’s why you can use it in a workflow. But at time of checkout the order hasn’t been created yet, so instead, you need to look in the shopping_cart data:
https://docs.treepl.co/component-types/shopping_cart

Also, if you are checking a number value in your if statement (such as the total price) be sure to use the raw price value (integer) and not the HTML formatted version, else the comparison could fail.
So totalPrice instead of totalPriceHtml.

On your checkout layout you could change your IF statement to something like this:

{% if shopingCartData.totalPrice > 1000 %}
...

shoppingCartData is a custom variable, so this may be different in your setup and may need to be changed to your currently defined variable.

Also note, the shopping_cart component is by default setup in the checkout form code, so if you haven’t already moved this to the checkout system page you may need to do that too so that you can access the data on that page rather than just in the form layout.

@Adam.Wilson it is working beautifully! Thank you for pointing out that it is the shopping cart data that is being used still in this layout and doesn’t become an order until it is processed :smiley: