Checkout process

Written by Max Milbers. Posted in Concepts

VirtueMart handles the whole checkout process in the cart object. The cart object keeps all important information which characterise the shopper, products and selected options. This data is stored in the session.

The checkout process is handling the contract of sale. The checkout button indicates that the cart is only offering a contract. But using the confirm button means that the shopper signs the contract. This behaviour reflects the juristic process and complies with updated laws.

For registered shoppers that Login - if they have items in their cart and do not complete the checkout process - the cart data is stored and will be retrieved when next they login.  This feature can be of great benefit to store owners, as their valued registered customers (who are not able to complete their order at a single visit) do not have to add all the products again on their next visit.

When viewing the cart a check is performed to ensure that all checkout requirements are met.

  • If all requirements have been met a "confirm" button is shown
  • If items still need to be selected or completed (e.g. Billign address) a "checkout" button is shown.  The "checkout" button directs the shopper to the right steps to complete the missing information.

When the "One Page Checkout" is enabled in the vm configuration/checkout tab, the customer is only redirected to the Billing address input (as the other elements required for selection or input are shown on the Checkout page). Due user interaction, the cart may check in the background if all requirements are met and directly display the confirm button.

Shipping and Payment methods

The cart loads all published methods (e.g. Payment and Shipping) and checks the configured conditions.

Should the method/s and their configuration/s  result in no method being available for this cart (e.g. cart weight does not match any shipping methods, posibbly due to a weight range configuration), it shows an error message with link to the configuration.

When only one method is matched, it is autoselected.

If more than one method is matched, the configurations "Enable Automatic Selected Shipment" or "Enable Automatic Selected Payment" options can be used to auto select you preferred method.  To ensure that the user makes positive choice from the options displayed, do not configure these options.

Shopperfields display

The shopperfields have the attribute "show in cart", which makes it easy to extend the cart for any purposes. If two checkboxes are required and the second checkbox is checked, the js of the cart checks automatically in the background, if all requirements are meet and can directly display the confirm button.

For templaters and developers

The loaded cart object keeps all important information and is accessible in the layouts. It is usually available with $this->cart.

Sometimes the cart is not prepared, if this occurs, just use prepareCartData().

Cart update actions are now handled by the "updatecart" task in the controller. The reason is that almost any selection can influence another value or decision, so it is always necessary to recalculate and reload the whole cart.