How to Customize the Shopp Checkout.php Template for WordPress

I really enjoy working with new web technologies and recently I’ve been working with the Shopp plug-in for WordPress.  The plug-in itself is a little quirky because there is no free or basic version of the plug-in however you do get what you pay for and in this case Shopp delivered on my expectations.

One thing that I am sure most people running an ecommerce website need is customization during the checkout process.  Shopp does allow for customization and styling the shopping cart which can be difficult depending on the shopping cart you use.  Today I am going to show you some PHP code that will allow you to add fields to your checkout page in Shopp.  If you have some custom fields that you need to add to your checkout page on your ecommerce website you can do so with the following tag.

<?php shopp(‘checkout’,’order-data’, ‘name=Comments&type=textarea’); ?>

What this tag allows for is two things.  One is that you can create a form field on the checkout page of a certain type (text, textarea, etc.) and two, you can collect this information on the receipt of the order and it will appear in the backend when you view the order under “Details”.

Another thing that you may want to tweak about the Checkout.php page in Shopp is where it says “Same Shipping address” checkbox.  By default this is always going to be checked however you may not want this option selected.  In order to do this you must edit the checkout.php file where the following tag is found…

<?php shopp(‘checkout’,’same-shipping-address’); ?>

And change it to…

<?php shopp(‘checkout’,’same-shipping-address’,’checked=off’); ?>

Adding “checked=off” variable means that the checkbox will be loaded when the web page loads as an unchecked checkbox and doing this in Shopp will show both the Billing and Shipping Address fields and it will look similar to this…

I hope that if you are using Shopp plug-in for WordPress that these tips saved you a little time.

Luc

Comments

  1. shopp dev says

    Hey Luc,

    would you provide a bit more info for a noob.

    for example, the actual code to create a specific form field on the checkout page.

    I need to add a fieid, but fear that i’d make a mistake.

    thanks!

    sd

  2. Luc Arnold says

    Hey Shopp Dev,

    Sure thing. Is anyone else interested in seeing a snippet of code that accomplishes this functionality? Otherwise I will just send you an email.

    Talk soon

    Luc

  3. says

    Hey Ben,

    I guess it might make sense to post that info here then. Thanks for the interest and stay tuned for the snippet of code on this.

    Luc

  4. says

    Hey Guys,

    Please see the following snippet of code to show how you can use ‘order-data’ tag to add custom fields to the checkout.php template in the Shopp plugin….


    < ?php shopp('checkout','order-data','name=Gift Contact&type=text&required=false&title=Contact name of the person receiving the gift'); ?>

    I hope that gives everyone a little more insight into coding this!

    Luc

  5. Garry Schafer says

    Hey there

    Is there a way of adding custom account data to shopp – ie needing to add the ability to have linked accounts or at least children (it’s a school lunch program I’m trying to code).

  6. says

    Hi Garry,

    In the past in built it some ability to collect custom account data related to orders. Where are you looking to collect this account data from specifically? During a checkout process? Talk soon Garry,

    Luc

  7. Garry Schafer says

    What I really need to do is have a user create an account and then create x amount of student (their children) with info such as child’s name, grade, school, and upon checkout the user would select the student which would be reflected on the receipt.

    If this is something you’d even be interested in implementing please contact me at my email. Thanks Luc

  8. says

    Hi Luc,

    I am most definitely a noob at shopp, and php isn’t my strong suit! Could you give me the exact code (and where to place it in the checkout.php file of your example on adding order comments discussed in your article?

    Please email it to me if possible.

    Regards,
    Dana

  9. says

    Hi Dana,

    I can definitely provide the code to you however if you need any further help implementing this please feel free to contact me. Talk to you soon Dana,

    Luc

  10. says

    Luc,

    Thanks for the great post. It is exciting to find more documentation on Shopp by individuals to enrich the experience for all of us using the plug-in.

    Here’s my question… How do I set the box for marketing to be checked as a default? I tried modifying your suggestion here and added ‘checked=on’ to in this way… … but this didn’t work.

    I’d sure appreciate a suggestion and I sense others will be looking for this solution too.

  11. says

    Hey Max,

    You’re welcome. Its a great question you asked. I actually figured this out when working on shopp projects in the past and what I can tell you is that the default for the same-shipping-address is defaulted to checked. If you want to have a checkbox “checked” by default what you need to do is add the following code to the checkbox field.

    < ?php shopp('checkout','same-shipping-address','checked=off'); ?>

    Is the checkbox that you are trying to default as “checked” a standard checkbox or a custom checkbox field you created? Feel free to post the code in question Max,

    Luc

  12. says

    Luc,
    Thanks for your answer… it looks like the code that I included dissappeared so I will try to write again for clarification.

    I am trying to get the check box before the line “Yes, I would like to receive e-mail updates and special offers!” to default to be checked (it currently defaults to not checked).

    I would guess the line that needs editing is: shopp(‘checkout’,’marketing’,’title=’.__(”,’Shopp’)) and I tried adding ‘checked=on’ but that didn’t seem to work.

    I’m sure you’ve got the answer!

  13. says

    Hi Max,

    I’ve actually searched the forums on the shopp site and noticed that this functionality may be disabled for this “checked” option. As to why it may be disabled I think this is a question for the guys at Shopp. My only thought is that because its a checkbox for opting in or out of marketing that it may not comply with spamming laws if its checked by default but that is just an educated guess. Talk soon Max,

    Luc

  14. Eddie says

    Hi Luc,

    Thanks for your insight into this. I used the code:

    in checkout.php and did a test order, but the order-data dos not show up in admin. Do I need to add some more code somewhere else?

    Thanks SO much.

    Eddie

  15. says

    Hi Eddie,

    I’ve added the order-data tags in the past to the Special Instructions and Notes section on the order page in the backend before and you’d need to add code to collect these values and represent them in the backend. Hope that helps Eddie,

    Luc

  16. Eddie says

    Thanks Luc!!

    However, I don’t see “Special Instructions and Notes section on the order page “… in admin.

    Am I missing something?

    Eddie

  17. Tommy says

    Hi, thanks for a great tip. I’ve used it for “Special delivery instructions” too. But do you know how I can manage to show the input on the users receipt page (receipt.php) ?

  18. says

    Hi Eddie,

    If you haven’t changed this then its probably called “Details” on the orders generated by Shopp. Hope that helps clarify things.

    Luc

  19. Aleksandar says

    Thanks man.
    Great article. You really saved me a lot of time.
    Please keep writing about shopp plugin cause there are not much of tutorials out there on this topic.

  20. says

    Thanks for the compliment Aleksander. i am glad you found it useful in your Shopp development. Are there any topics that you’d like me to cover in greater depth around Shopp?

  21. Marc says

    Thank you Luc! Very helpfull!

    Can you tell me if there is a way to make a drop-down list with option value’s wich are shown in the order data?

    Marc

  22. says

    Hi Luc,
    Let me be the first in 2012 to add a comment… your method of explaining is crystal clear, thank you. Three questions please; when I open the checkout.php file in notepad++,
    1.where exactly do I put this code
    2. Do I ignore the warning messages at the top of the page of script ?
    3. At the moment I am only registered to take payments from Paypal… Does Paypal bypass the checkout.php altogether ?
    I need to add a box for customers to enter “Baby’s Name” and another for “Baby’s date of Birth” From what I can figure this seems to be the only place to get this info from the customer. I look forward to your reply.. kind regards.. Noreen

  23. says

    Hello Noreen,

    Thanks for your comment and i am glad you’ve found it useful.

    1. If you are referring to the custom order tags then you place those in the checkout.php page where you want the fields to appear. Can you clarify if you are trying to use a different piece of code mentioned?
    2. in the Checkout.php file this is something the Shopp team has added. I’ve tested this and it works but please remember to test when you customize.
    3. Basically Paypal should redirect the user to the paypal site and then redirect the user after payment is made back to the website

    If you need help with the baby name and date of birth collection feel free to reach out to me. Talk soon Noreen!

    Luc

  24. says

    Hello Marc,

    I believe that you can do this using the “type” variable. type: Specifies the type of field. It accepts text, password, checkbox, radio, hidden, textarea, menu. Here is a sample…

    "< ?php shopp('checkout','order-data', 'name=Gift&title=Gift&type=menu&options=Yes,No'); ?>"

    I hope that helps you,

    Luc

  25. marc says

    Hello Luc!

    Thanks a lot for this information! It helped me a lot. But do you know if there is also a way to make optiongroup labels, like ?

    Marc

  26. says

    Hi Marc,

    Thanks glad to help! Was there some code that you added to the comments field that I am not seeing? I don’t understand the question the way its written currently, Please clarify it a little bit for me. Talk soon Marc,

    Luc

  27. marc says

    Hi Luc,

    yes, there is some code missing.
    I have a lot of option value´s in my dropdown list, so I want to arrange them. In normal forms you can make a optgroup, like .

    I hope you can help me.

    Marc

  28. says

    Hi Luc,

    Thank you very much for writing this excellent tutorial. This is exactly what I needed for a project I’m currently working on! :-)

    Melvin

  29. says

    Hi Luc,

    Thank you for the great article. Much appreciated!!
    I was just wondering if there is a way with the Shopp plugin to ask product specific checkout questions.

    For instance:
    “Product A” is an event and I want to ask the customer “Will you be staying in the hotel.”
    and
    “Product B” is a book, so I don’t need to ask any extra questions.

    Do you know a solution for this?

    Any help would be greatly appreciated.

    Sincerely,
    Shawn

  30. says

    Hi Shawn,

    You’re welcome. What you might want to consider doing when it comes to recognizing a certain product during the checkout of your Shopp store is to use a tag, use the “tagged” code function and some custom Javascript to show or hide questions based on the product at the checkout. That’s just my two cents but I hope it helps.

    Regards,

    Luc

  31. Jarco de Jonge says

    Hello Luc,

    I don’t need an billing adress at my shopp plugin. I sell digital products (like an e-book)
    How can I easily change it that my custommers only need to fill in their firsname / lastname and mailadress?

    Thanks for the helping hand!

  32. says

    Hi Jarco,

    I would suggest customizing the checkout.php if needed and remove the code that handles billing but first check to see if the option for selling downloadables is checked to see if this fixes the problem. All the best,

    Luc

  33. Sam says

    Hi,

    I’m wondering whether it’s possible to disable payment on checkout? My client would like to have a products catalog site with a shopping cart, but no payment option. Only to send a quote with selected products? Seems like there is no easy way to customize Shopp checkout…

  34. Angela Raymond says

    Luc, Hi. I was lucky enough to come across your site here and was wondering if some of the things listed may be outdated with the new release of SHOPP. It seems they have changed a lot of their systems. Could you do the same with product categories instead of tags?

  35. Richard Johnson says

    Hi. Have you seen the Shopp Wholesale plugin? We haven’t been able to get it to work. Once installed and configured we can’t see the prices in the products. Just wondered if you had any ideas. Thanks.

  36. paul says

    hi luc your forums are great by the way a good read

    do you know if there is a way to add shipping onto a donation product or virtual products??

  37. says

    This is juts the article i needed so many thanks. Site has also been bookmarked for future.

    Is there a way once the customer ticks the box to say same as billing it will auto pull through those address details to the shipping address fields in checkout?
    I know this pulls through on the backend but think it will reassure customer if they see the address lines filled in.
    I have had a couple of customers contact me after as they wasn’t convinced I got the delivery address as to them on the front end these fields were blank even though the box was ticked.

Leave a Reply

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.