1

I'd like to add a field such as this to be passed to google checkout:

Using SimpleCart(js) VERSION 3.0.5

I think this field should be appended in the function found in simplecart.js file below, but I'm having trouble getting it to work. Can someone help please? I tried appending the field, but I'm not an expert with jquery, and it never works. Thanks in advance!

    /*******************************************************************
     *  CHECKOUT MANAGEMENT
     *******************************************************************/

    simpleCart.extend({
        checkout: function () {
            if (settings.checkout.type.toLowerCase() === 'custom' && isFunction(settings.checkout.fn)) {
                settings.checkout.fn.call(simpleCart,settings.checkout);
            } else if (isFunction(simpleCart.checkout[settings.checkout.type])) {
                var checkoutData = simpleCart.checkout[settings.checkout.type].call(simpleCart,settings.checkout);

                // if the checkout method returns data, try to send the form
                if( checkoutData.data && checkoutData.action && checkoutData.method ){
                    // if no one has any objections, send the checkout form
                    if( false !== simpleCart.trigger('beforeCheckout', [checkoutData.data]) ){
                        simpleCart.generateAndSendForm( checkoutData );
                    }
                }

            } else {
                simpleCart.error("No Valid Checkout Method Specified");
            }
        },
        extendCheckout: function (methods) {
            return simpleCart.extend(simpleCart.checkout, methods);
        },
        generateAndSendForm: function (opts) {
            var form = simpleCart.$create("form");
            form.attr('style', 'display:none;');
            form.attr('action', opts.action);
            form.attr('method', opts.method);
            simpleCart.each(opts.data, function (val, x, name) {
                form.append(
                    simpleCart.$create("input").attr("type","hidden").attr("name",name).val(val)
                );
            });
            simpleCart.$("body").append(form);
            form.el.submit();
            form.remove();
        }
    });

0 Answers0