Developer forum

Forum » Ecommerce - Standard features » Discount - Order field value

Discount - Order field value

George Nelzo Pereira
Reply

Hi, anybody have one idea how to check (in the cart) if the value in "Order field discount" is correct (im mean is the same to get discount)
I'm using this to have one unique code like a Voucher to use for more people to give the same discount.
We want to check if the value is valid to use.


Replies

 
Nicolai Høeg Pedersen
Reply

Hi George

Yes, simply type in the name of the voucher code you want people to use instead of choosing a voucher list. See dump.

Simply add an input field for the voucher code like you would normally do:

<input type="text" class="form-control" placeholder="@Translate("Enter voucher code", "Enter voucher code")" name="EcomOrderVoucherCode" id="EcomOrderVoucherCode" value="@GetString("Ecom:Order.Customer.VoucherCode")">

Capture.JPG
 
Aki Ruuskanen
Reply

What if I have a Orderfield discount (not a voucher) and want to add it to the cart in checkout (I'm using one-step-checkout template in solutionset in this one). 

I tried this, but the order gets submitted anyway.

    function checkCode() {
        var form = document.getElementById('ordersubmit');
        var field = document.createElement('input');
        field.type = 'hidden';
        field.name = 'CartV2.GotoStep1';
        field.id = 'CartV2.GotoStep1';
        field.value = 'Update';
        form.appendChild(field);
        form.submit();
    }

 

You must be logged in to post in the forum