• Resolved lakhai

    (@lakhai)


    I’m trying to set up a custom checkout form but can’t seem to get it working.
    What is the best way to make a custom checkout form to bypass the checkout page (I create the cart order through AJAX and want to just pay for it with only the payment method and directly land in the thank you page)?

    https://ww.wp.xz.cn/plugins/jigoshop/

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author Jigoshop Support – Marcin

    (@azrielnefezen)

    Hi lakhai,
    And what about the client’s details? Billing, Shipping address?
    Could you explain what exactly are you trying to achieve and how what did you try so far?

    Thread Starter lakhai

    (@lakhai)

    Wow, that was a quick response!
    Alright, so I had this working on a very old version of the plugin.
    What I did was explained a bit better here: http://stackoverflow.com/questions/35548357/jigoshop-custom-checkout-form
    After this I experimented a bit (and remembered some, too) and had to remove via:

    $billing_fields = array(
    	 array( 'name'=>'billing-first_name', 'label' => __('First Name', 'jigoshop'), 'placeholder' => __('First Name', 'jigoshop'), 'required' => false, 'class' => array('form-row-first') ),
    	 array( 'name'=>'billing-last_name', 'label' => __('Last Name', 'jigoshop'), 'placeholder' => __('Last Name', 'jigoshop'), 'required' => false, 'class' => array('form-row-last') ),
    	 array( 'name'=>'billing-address', 'label' => __('Address', 'jigoshop'), 'placeholder' => __('Address', 'jigoshop'), 'required' => false ),
    	 array( 'name'=>'billing-city', 'label' => __('City', 'jigoshop'), 'placeholder' => __('City', 'jigoshop'), 'required' => false ),
    	 array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'billing-postcode', 'label' => __('Postcode', 'jigoshop'), 'placeholder' => __('Postcode', 'jigoshop'), 'required' => false, 'class' => array('form-row-first') ),
    	 array( 'type'=> 'country', 'name'=>'billing-country', 'label' => __('Country', 'jigoshop'), 'required' => false, 'class' => array('form-row-last') ),
    	 array( 'name'=>'billing-email', 'validate' => 'email', 'label' => __('Email Address', 'jigoshop'), 'placeholder' => __('***@yourdomain.com', 'jigoshop'), 'required' => false )
    	 );
    	 jigoshop_checkout::instance()->billing_fields = $billing_fields;

    Worked a few times (to not give me an error for missing fields, but then it didn’t work anymore…
    Apart from that, I changed the nonce field to pay and I got an “Incorrect action” error, which on the old plugin it didn’t work either. I also added a hidden input field with the name submit_action with the value place_order but still didn’t change the action.

    What I need is to just choose either “account funds” or “credit cards” (which needs card details such as number, code, etc.) and with only this it’ll pay for the order and go directly to the “thank you” page.

    Thread Starter lakhai

    (@lakhai)

    Anybody has an idea?

    Plugin Author Jigoshop Support – Marcin

    (@azrielnefezen)

    Well, for starters, I honestly don’t know if we even have a payment gateway like that.
    What is more – you’d break the current order mechanic.
    I’d need to see the exact soluiton you’re trying to apply for me to help you.

    Thread Starter lakhai

    (@lakhai)

    I already had this working in the past, after removing all the required fields you could checkout with only the payment gateway and nonce field.
    My payment gateways are “Jigoshop Stripe” and “Account Funds” both working perfectly too.
    I can provide whatever detail you need, just let me know.

    Plugin Author Jigoshop Support – Marcin

    (@azrielnefezen)

    And now you’re getting “Action failed”, right?
    Try this in your theme’s functions.php :

    add_filter( 'nonce_life', function () { return 120 * HOUR_IN_SECONDS; },-1 );
    add_filter( 'nonce_user_logged_out',function(){return true;},-1);

    Thread Starter lakhai

    (@lakhai)

    Nope, still action failed…

    Plugin Author Jigoshop Support – Marcin

    (@azrielnefezen)

    Wait, wait, wait…you changed the nonce field to “pay”?
    Try changing it back to nonce.

    Thread Starter lakhai

    (@lakhai)

    Actually I was using place_order, which is what my old form had. Let me try that.

    Thread Starter lakhai

    (@lakhai)

    Neither of those worked, “place_order” and “pay” both give “action failed” error

    Thread Starter lakhai

    (@lakhai)

    And now for some reason when I try to normally pay for the order form the checkout page I have the required fields error too…

    Plugin Author Jigoshop Support – Marcin

    (@azrielnefezen)

    Ok – try contacting us via the contact form on jigoshop.com, I’ll try to resolve this issue.

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Custom checkout form’ is closed to new replies.