Collector Checkout – Customize the checkout page
Introduction
Hooks in WordPress essentially allow you to change or add code without editing core files. They are used extensively throughout WordPress and WooCommerce and are very useful for developers.
Read more about action and filter hooks here:
In Collector Checkout for WooCommerce there are some action hooks available, mainly for how the checkout page should be displayed.
The default layout of the checkout page
The appearance of the Collector Checkout page comes with a one-column layout. In this layout we have the following sections displayed:
- Shopping cart delivery options.
- Customer order note.
- Select another payment method button (if offering other payment methods).
- B2C / B2B switcher (if selling to both customer types).
- Collectors checkout (where you enter personal information and choose payment method)
Sometimes you need to change the design of the checkout page and with Collector Checkout for WooCommerce it is possible in a couple of different ways.
Design changes via CSS
If you only want to make minor design changes, CSS adjustments may be enough to get you where you want.
For example, to create a checkout page with a two-column layout, add the following CSS to your theme:
https://gist.github.com/krokedilgists/00f27c4a0570425e6b8aa687ef7ce88d
Remove, add and move with action hooks
If you want to make some more extensive changes to the layout of the checkout page, it is recommended to work with action hooks.
The checkout template file
templates/collector-checkout.php
On the Collector Checkout template page, there are several action hooks you can use to add code or content. These hooks have the following names:
collector_wc_before_checkout_form
collector_wc_before_order_review
collector_wc_after_order_review
collector_wc_before_iframe
collector_wc_after_iframe
Through these action hooks, you can easily add information to different locations on the checkout page.
Create your own template file
If you need to make changes that can’t be accomplished via action hooks, then you are able to overwrite the checkout template file via your theme. The plugin supports WooCommerce’s way of handling template files.
The template file used for displaying Collector Checkout is called collector-checkout.php and it is located in the templates
folder in the plugin. To overwrite the file, copy it from the plugin, then paste it into the /woocommerce
folder in your theme. Now you have the opportunity to make the changes you want. Keep in mind that the action hooks collector_wc_before_checkout_form
and collector_wc_after_iframe
must remain for the plugin to work properly.