Add fields to checkout page.


I need to add settings fields to the checkout page? Is there a hook that I can use. Basically I want to know prior to shipping if the user is from Australia or not.

What I want achieve is displayed in attached screenshot.


  • patnz

    Hi, yeah because this is on the cart page, before any shipping information has been entered. I need it to calculate the shipping price and display a total on the cart page. The problem I have with the whole checkout process is I'm using paypal, and the customer never sees a total price, including shipping before being sent to paypal. I am setting up table rate shipping based on items in cart with one set of rates for Australia and a higher set for everywhere else. The calculations work fine, but the user never sees a total until PayPal.

    I've been mucking round trying to set up what I've mocked up in that screenshot. I hacked a custom filter into the display cart table function, and added the form (in the mockup image above) from my shipping class. Thought I almost had it working but then I cleared all cookies and found that the shipping is only calculated on the cart screen if the shipping has been filled out already, which under normal use conditions is never going to happen.

    So I tried to set a default shipping country to the session variables to force it to calculate on the cart page but the test in template_functions.php obviously looks for more than that.

    function _mp_cart_table($type = 'checkout', $echo = false) {
    // my filter hack
    $content = apply_filters('mp_cart_after_coupon', $content);   
    	//shipping line
        if ( $shipping_price = array_sum($shipping_prices) ) {

    I've found MarketPress a great plugin, the settings are really simple and easy to use, the code is really clean and well documented, theming is nice out of the box, and easy to mod but then the checkout process just seems really clunky. Not being able to set a final overview page before sending to PayPal basically makes this unusable for me...

    Is this something I could add into the paypal gateway?

    Anyways, rant over, it's feedback not criticism :slight_smile: in every other way the plugin is fantastic..


  • patnz

    Cheers. I just set up a manual payments option as well and see that goes to a review order screen /shop/confirm-checkout/ which shows all the details. So I guess the problem is with the paypal gateway going directly to paypal rather than to the review page and then on to paypal from there.

    I also see the same cart table is used on this review page and so the form I'm trying to add is not going to work in there either.

  • Aaron

    The paypal checkout shows the confirmation screen after they make their authorization in their paypal account. It is still before it's charged. The shipping is also shown on the paypal approval screen.

    Seems like a matter of preference to me, but you can fairly easily change the paypal gateway to show the confirmation screen before the redirect to paypal, it's just a matter of moving the code from one method/step to another, you can look at some of the other gateways for examples.

    To add that field in the cart table there isn't a hook for that there, and they would still have to save it. Setting a default session variable seems like the best idea to me, just keep in mind that can only be done on that cart page, because a session is not initialized except on that page.

  • ozbod


    yes I am with you there, both me and my clients prefer to have the review order page prior to Pay Pal so Market Press is being put on the shelf for now sadly until this functionality becomes available.

    Sadly I don't have the knowledge to go hacking like you have! So I have spent the last week or so working on updateing to the latest version and cofiguring WP-Ecommerce, which once you get your head around it, isn't too bad now.

    Yes its been around for a lot longer than MP and maybe thats how I realsie whats missing in MP in terms of options and functionality, but MP is relaively young and there is time for it to grow.

    Which is qute sad really because it was Market Press that led me to joining WPMU, but there is lots of other great stuff available on here so membership is still worth every penny.



  • patnz

    Yeah for me as a user, being sent to PayPal is the final step before a thankyou page. After playing around with this for a while I see that they've set it up so when you are sent to paypal you are not actually making payment but authorising to make payment. You are then returned to a final checkout page, where you see all your results and when you click purchase on that page your paypal account is charged then, and you are then taken to thankyou/order processed page.

    So I kinda understand the logic to it a bit more now but I think for users this is really confusing. As far as I'm concerned when I click the button on paypal that's when I make the purchase.

    Anyways, will post if I manage to hack the gateway successfully, I haven't worked with paypal api and I think what I want to achieve is different to what they have setup...

    Good luck with wp ecommerce, I've had some experience with that and code wise it's a bit of a nightmare, (to be fair I haven't really used the latest version) but it does have a lot of features. There's also Jigoshop which looks quite nice. Of the three I'm liking Marketpress the most, just hope I can work a way around this gateway..

  • ozbod

    I too can see the "flow" but I firmly believe that customers want to know their complete bill before Pay Pal, as the vast majority will feel that as soon as they go to Pay Pal they are in the payment process, in fact this is also the feedback I get from my clients when I have shown the MP, so it's not you and me that feel this way.

    It will e great once its addressed and sorted.



  • Aaron

    Ok, really guys this is not a bug per say, it's just the way paypal express checkout does things if you read the API docs. It's an authorization, and they highly recommend you have a final confirmation step after the authorization. In fact the whole checkout process was built around this, though it most other gateways work differently.

    Nevertheless, i've tryed to hack together a workaround for you. It's attached. Would you all please test it and let me know if you run into any troubles? Also let me know if you tested it with regular or global checkout (need to test both).

  • ozbod

    Hi Aaron,

    firat am I applying this correctly, I have tried renaming orginal paypal-express.php tp paypal-express-original.php in:


    and then uploaded the new version.

    The result is that the site dissappears althogether, have tried this method on two installations and same result for both.

    Versions WP 3.2.1
    MP 2.1.3
    Theme Gridmarket 1.2

    Am I doing something wrong?



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.