This is the API docs for LemonStand V1, which has been discontinued. LemonStand is now a cloud based platform, available at lemonstand.com.

LemonStand API

shop:checkout CMS action

Defined in /modules/shop/classes/shop_actions.php, lines 1267-1517
Author LemonStand eCommerce Inc.
Base action for the Checkout page. The checkout process is split to several steps. A current step name is always available through the $checkout_step field. The field can have the following values:
  • billing_info - corresponds to the Billing Information checkout step.
  • shipping_info - corresponds to the Shipping Information checkout step.
  • shipping_method - corresponds to the Shipping Method checkout step.
  • payment_method - corresponds to the Payment Method checkout step.
  • review - corresponds to the Order Review checkout step.
A set of form fields required and supported by the action depends on a current checkout step. The $checkout_step field is required on each step.

Supported form fields

Field Type Context Description
checkout_step string Any checkout step specifies a current checkout step. Required.
skip_to string Any checkout step allows to switch the checkout process to a specific step.
auto_skip_shipping string Any checkout step allows to skip the Shipping Method step if the shopping cart contains only non-shippable items.
empty_cart string Any checkout step allows to leave the cart content after the order is placed.
cart_name string Any checkout step optional field, the shopping cart name. Use it if you want to the checkout to work with a specific shopping cart.
first_name string Billing and Shipping information steps specifies the customer billing first name. Required.
last_name string Billing and Shipping information steps specifies the customer billing last name. Required.
email string Billing and Shipping information steps specifies the customer email address. Required.
company string Billing and Shipping information steps specifies the customer company name. Optional.
phone string Billing and Shipping information steps specifies the customer phone number. Optional.
street_address string Billing and Shipping information steps specifies the customer billing street address. Required.
city string Billing and Shipping information steps specifies the customer billing city. Required.
zip string Billing and Shipping information steps specifies the customer billing ZIP code. Required.
country string Billing and Shipping information steps specifies the customer billing country identifier. Required.
state string Billing and Shipping information steps specifies the customer billing state identifier. Required.
is_business boolean Shipping information step determines whether the shipping location is a business address. Optional.
register_customer boolean Billing information step use this field if you want a customer to be automatically registered on checkout.
allow_empty_password boolean Billing information step determines whether customers should enter a password to register.
customer_password string Billing and Shipping information steps specifies the customer password.
customer_password_confirm string Billing and Shipping information steps specifies the customer password confirmation.
no_password_error string Billing information step specifies an error message to display in case if the customer did not specify the password.
passwords_match_error string Billing information step specifies an error message to display in case if the password and its confirmation do not match.
customer_exists_error string Billing information step specifies an error to display in case if a customer with the specified email address already exists.
customer_auto_login boolean Review step determines whether the new customer should be automatically logged in customer in after placing the order.
customer_registration_notification boolean Review step determines whether a registration notification email message should be sent to the new customer.
shipping_option mixed Shipping method step specifies an identifier of selected shipping method.
payment_method mixed Payment method step specifies an identifier of selected payment method.

Generated PHP variables

Variable Type Context Description
checkout_step string Any checkout step specifies a current checkout step.
billing_info Shop_CheckoutAddressInfo Any checkout step an object of the Shop_CheckoutAddressInfo class containing the customer's billing name and address.
shipping_info Shop_CheckoutAddressInfo Any checkout step an object of the Shop_CheckoutAddressInfo class containing the customer's shipping name and address.
shipping_method object Any checkout step a PHP object representing a selected shipping method.
payment_method object Any checkout step a PHP object representing a selected payment method.
coupon_code string Any checkout step specifies a coupon code entered by a visitor.
discount float Any checkout step specifies an estimated cart discount.
applied_discount_rules array Any checkout step contains a list of discount rules applied to the cart products.
cart_total float Any checkout step specifies the cart total value (subtotal).
estimated_total float Any checkout step specifies an estimated total value.
estimated_tax float Any checkout step specifies an estimated tax value.
shipping_required boolean Any checkout step determines whether the shopping cart contains only non-shippable items.
countries Db_DataCollection Billing and Shipping information steps a collection of countries for populating the Country list.
states Db_DataCollection Billing and Shipping information steps a collection of states for populating the State list.
shipping_states Db_DataCollection Billing information step a collection of states for populating the Shipping State list.
shipping_options array Shipping method step a list of available shipping options.
shipping_options_flat array Shipping method step a flat list of shipping options.
goods_tax float Payment method step specifies a value of a goods tax.
subtotal float Payment method step specifies the order subtotal amount.
shipping_quote float Payment and Shipping method steps specifies a shipping quote value.
shipping_tax float Payment method step specifies a shipping tax value.
payment_methods array Payment method step a list of applicable payment methods.
goods_tax float Review step specifies an amount of the sales tax.
subtotal float Review step specifies the order subtotal amount.
shipping_quote float Review step specifies a shipping quote value.
shipping_tax float Review step specifies a shipping tax value.
total float Review step specifies the order total amount.
discount float Review step specifies a total discount value.
product_taxes array Review step a list of sales taxes applied to all order items.
shipping_taxes array Review step a list of taxes applied to the shipping service.
taxes array Review step a list of all taxes applied to products and shipping.

Built-in AJAX handlers

Handler Description
on_action Posts a current step form data to the server, validates form data and switches the checkout process to a next step.
shop:on_copyBillingInfo Copies billing information (a customer name and address) to the shipping information checkout step.

Supported form field details

checkout_step form field

Context: Any checkout step

Specifies a current checkout step. Required. Depending on a value of this field, LemonStand validates corresponding form fields and switches the checkout process to a next step, when a customer clicks the Next button.

skip_to form field

Context: Any checkout step

Allows to switch the checkout process to a specific step.

auto_skip_shipping form field

Context: Any checkout step

Allows to skip the Shipping Method step if the shopping cart contains only non-shippable items. Please read Skipping the Shipping Method step for downloadable products or services article to learn how to configure LemonStand to skip the shipping method checkout step.

empty_cart form field

Context: Any checkout step

Allows to leave the cart content after the order is placed. This allows your customers to return to previous checkout step even if they already placed the order. The default value is 0 (false).

cart_name form field

Context: Any checkout step

Optional field, the shopping cart name. Use it if you want to the checkout to work with a specific shopping cart. Please refer to the shop:cart action documentation for the multiple shopping cart feature description.

first_name form field

Context: Billing and Shipping information steps

Specifies the customer billing first name. Required.

last_name form field

Context: Billing and Shipping information steps

Specifies the customer billing last name. Required.

email form field

Context: Billing and Shipping information steps

Specifies the customer email address. Required.

company form field

Context: Billing and Shipping information steps

Specifies the customer company name. Optional.

phone form field

Context: Billing and Shipping information steps

Specifies the customer phone number. Optional.

street_address form field

Context: Billing and Shipping information steps

Specifies the customer billing street address. Required.

city form field

Context: Billing and Shipping information steps

Specifies the customer billing city. Required.

zip form field

Context: Billing and Shipping information steps

Specifies the customer billing ZIP code. Required.

country form field

Context: Billing and Shipping information steps

Specifies the customer billing country identifier. Required.

state form field

Context: Billing and Shipping information steps

Specifies the customer billing state identifier. Required.

is_business form field

Context: Shipping information step

Determines whether the shipping location is a business address. Optional. Accepted values are 0, 1.

register_customer form field

Context: Billing information step

Use this field if you want a customer to be automatically registered on checkout. Accepted values are: 0, 1. If this field is not declared or its value is 0 (default), the following fields have no effect:
  • allow_empty_password
  • customer_password
  • customer_password_confirm
  • no_password_error
  • passwords_match_error
  • customer_exists_error
Please refer to the Automatic customer registration article for the implementation details.

allow_empty_password form field

Context: Billing information step

Determines whether customers should enter a password to register. Accepted values are: 0, 1. If the field value is 0, the password is not registered. In this case LemonStand will generate a random password. The default value is 0. You can set the field value to 1 and omit the customer password fields (customer_password, customer_password_confirm). The field has no effect if the register_customer field value is 0 (default).

customer_password form field

Context: Billing and Shipping information steps

Specifies the customer password. This field is optional if the allow_empty_password field has value of 1. The field has no effect if the register_customer field value is 0 (default).

customer_password_confirm form field

Context: Billing and Shipping information steps

Specifies the customer password confirmation. Use this field along with the customer_password field. The field has no effect if the register_customer field value is 0 (default).

no_password_error form field

Context: Billing information step

Specifies an error message to display in case if the customer did not specify the password. Default value is "Please enter your password.". The field has no effect if the register_customer field value is 0 (default).

passwords_match_error form field

Context: Billing information step

Specifies an error message to display in case if the password and its confirmation do not match. Default value is "Password and confirmation password do not match.". The field has no effect if the register_customer field value is 0 (default).

customer_exists_error form field

Context: Billing information step

Specifies an error to display in case if a customer with the specified email address already exists. Default value is "A customer with the specified email is already registered. Please log in or use another email.". The field has no effect if the register_customer field value is 0 (default).

customer_auto_login form field

Context: Review step

Determines whether the new customer should be automatically logged in customer in after placing the order. Accepted values are: 0, 1. The field has no effect if the register_customer field value is 0 (default).

customer_registration_notification form field

Context: Review step

Determines whether a registration notification email message should be sent to the new customer. LemonStand uses an email template with the shop:registration_confirmation code for the registration notification. Accepted values are: 0, 1. The field has no effect if the register_customer field value is 0 (default).

shipping_option form field

Context: Shipping method step

Specifies an identifier of selected shipping method.

payment_method form field

Context: Payment method step

Specifies an identifier of selected payment method.

Generated PHP variable details

checkout_step variable

string $checkout_step;

Context: Any checkout step

Specifies a current checkout step.

billing_info variable

Context: Any checkout step

An object of the Shop_CheckoutAddressInfo class containing the customer's billing name and address.

shipping_info variable

Shop_CheckoutAddressInfo $shipping_info;

Context: Any checkout step

An object of the Shop_CheckoutAddressInfo class containing the customer's shipping name and address.

shipping_method variable

object $shipping_method;

Context: Any checkout step

A PHP object representing a selected shipping method. The object has the following fields:
  • id - an identifier of the shipping method in LemonStand database.
  • quote - specifies the shipping quote.
  • name - specifies the shipping method name.

payment_method variable

object $payment_method;

Context: Any checkout step

A PHP object representing a selected payment method. The object has the following fields:
  • id - an identifier of the payment method in LemonStand database.
  • name - specifies the payment method name.

coupon_code variable

string $coupon_code;

Context: Any checkout step

Specifies a coupon code entered by a visitor.

discount variable

float $discount;

Context: Any checkout step

Specifies an estimated cart discount. You can display this value during the checkout process.

applied_discount_rules variable

array $applied_discount_rules;

Context: Any checkout step

Contains a list of discount rules applied to the cart products. Each element in the array is an object with two fields:
  • rule - Shop_CartPriceRule Discount rule object.
  • discount - specifies the discount amount.
You can use this variable for displaying a list of applied discounts. Example:
<h3>Applied discounts</h3>
<? foreach ($applied_discount_rules as $rule_info): ?>
  <p>
    <?= $rule_info->rule->name ?> 
    <?= $rule_info->rule->description ?> - 
    <?= format_currency($rule_info->discount) ?>
  </p>
<? endforeach ?>

cart_total variable

float $cart_total;

Context: Any checkout step

Specifies the cart total value (subtotal).

estimated_total variable

float $estimated_total;

Context: Any checkout step

Specifies an estimated total value. This value is calculated on each step of the checkout process, taking into account price rules and known information about the customer.

estimated_tax variable

float $estimated_tax;

Context: Any checkout step

Specifies an estimated tax value. This value is calculated on each step of the checkout process, taking into account price rules (defined on the Shop/Discounts page page) and known information about the customer. The tax value includes the goods tax and shipping tax.

shipping_required variable

boolean $shipping_required;

Context: Any checkout step

Determines whether the shopping cart contains only non-shippable items. This variable is FALSE if the shopping cart contains only non-shippable items (downloadable products or services). *

countries variable

Db_DataCollection $countries;

Context: Billing and Shipping information steps

A collection of countries for populating the Country list. Each element in the collection is an object of the Shop_Country class.

states variable

Context: Billing and Shipping information steps

A collection of states for populating the State list. Each element in the collection is an object of the Shop_CountryState class

shipping_states variable

Db_DataCollection $shipping_states;

Context: Billing information step

A collection of states for populating the Shipping State list. Each element in the collection is an object of the Shop_CountryState class

shipping_options variable

array $shipping_options;

Context: Shipping method step

A list of available shipping options. Each element in the array is an object of the Shop_ShippingOption class.

shipping_options_flat variable

array $shipping_options_flat;

Context: Shipping method step

A flat list of shipping options. In the flat list all options, including options returned by multi-option shipping methods, like FedEx, are presented in a single list. Each element in the array is an object of the Shop_ShippingOption class.

goods_tax variable

float $goods_tax;

Context: Payment method step

Specifies a value of a goods tax.

subtotal variable

float $subtotal;

Context: Payment method step

Specifies the order subtotal amount.

shipping_quote variable

float $shipping_quote;

Context: Payment and Shipping method steps

Specifies a shipping quote value.

shipping_tax variable

float $shipping_tax;

Context: Payment method step

Specifies a shipping tax value.

payment_methods variable

array $payment_methods;

Context: Payment method step

A list of applicable payment methods. Each element in the array is an object of the Shop_PaymentMethod class.

goods_tax variable

float $goods_tax;

Context: Review step

Specifies an amount of the sales tax.

subtotal variable

float $subtotal;

Context: Review step

Specifies the order subtotal amount.

shipping_quote variable

float $shipping_quote;

Context: Review step

Specifies a shipping quote value.

shipping_tax variable

float $shipping_tax;

Context: Review step

Specifies a shipping tax value.

total variable

float $total;

Context: Review step

Specifies the order total amount.

discount variable

float $discount;

Context: Review step

Specifies a total discount value.

product_taxes variable

array $product_taxes;

Context: Review step

A list of sales taxes applied to all order items. Each element in the array is an object containing the following fields:
  • name - the tax name, for example GST.
  • total - total tax amount.
You can output tax names and values with the following code:
<? foreach ($product_taxes as $tax): ?>
  <?= h($tax->name) ?>: <?= format_currency($tax->total) ?>
<? endforeach ?>

shipping_taxes variable

array $shipping_taxes;

Context: Review step

A list of taxes applied to the shipping service. Each element in the collection is an object containing the following fields:
  • name - the tax name, for example GST.
  • total - total tax amount.

taxes variable

array $taxes;

Context: Review step

A list of all taxes applied to products and shipping. Taxes are combined by names. Each element in the array is an object containing the following fields:
  • name - the tax name, for example GST.
  • total - total tax amount.

Built-in AJAX handlers details

on_action AJAX handler

Posts a current step form data to the server, validates form data and switches the checkout process to a next step. Use this hander for creating the Next button on the checkout page. Example:
<input 
  type="image" 
  src="/resources/images/btn_next.gif" 
  alt="Next" 
  onclick="return $(this).getForm().sendRequest('on_action', {update:{'checkout_page': 'checkout_partial'}})"/>

shop:on_copyBillingInfo AJAX handler

Copies billing information (a customer name and address) to the shipping information checkout step. Use this handler for creating a link Copy billing information on the shipping information step. Example:
<a 
  href="#" 
  onclick="return $(this).getForm().sendRequest(
    'shop:on_copyBillingInfo', 
    {update:{'checkout_page': 'checkout_partial'}})">
  billing information</a>