LemonStand Documentation

shop:checkout_shipping_info

The shop:checkout_shipping_info action is designed for creating the Shipping Information page for gathering the customer shipping address information during the step-by-step checkout process. The Shipping Information page is the second step of the conventional step-by-step checkout process. Please read the generic description of the step-by-step actions in the Step-by-step checkout actions article.

Supported and required form fields

The Shipping information page should contain a HTML form with the following fields. To post form data to the server using the regular POST method (non AJAX), create a submit input element with the "submit" name. To submit the form using the AJAX method, use the shop:on_checkoutSetShippingInfo handler, described in the Supported AJAX handlers section below.

  • first_name – customer shipping first name. Required.
  • last_name – customer shipping last name. Required.
  • company – customer shipping company name. Optional.
  • phone – customer shipping phone number. Optional.
  • street_address – customer shipping street address. Required.
  • city – customer shipping city. Required.
  • zip – customer shipping ZIP code. Required.
  • country – customer shipping country identifier. Required.
  • state – customer shipping state identifier. Required.
  • redirect - an ULR of a page to redirect the browser after processing the form data, if the provided information has no errors. Use a hidden field for supplying this value. If you are implementing a conventional checkout process, a value of this field will be a URL of the checkout Shipping Method page. Note: if your copy of LemonStand is installed in a subdirectory, you need to use the root_url() function to generate correct URLs referring to LemonStand pages.
  • customer_notes - optional field for entering the customer order notes.
  • coupon_code - optional field for entering the coupon code.
  • is_business - determines whether the shipping location is a business address. Optional.

Generated PHP variables

The action provides the following PHP variables, which you can access in the page code.

  • $shipping_info – an object of the Shop_CheckoutAddressInfo class representing a customer's shipping name and address.
  • $countries – a collection of countries for populating the Country list. The collection is an object of the Db_DataCollection class. Each element in the collection is an object of the Shop_Country class.
  • $states - a collection of countries for populating the State list. The collection is an object of the Db_DataCollection class. Each element in the collection is an object of the Shop_CountryState class.
  • $discount - estimated cart discount. You can display this value during the checkout process.
  • $cart_total - cart total value (subtotal).
  • $estimated_total - 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 - 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) and known information about the customer. The tax value includes the goods tax and shipping tax.

Supported AJAX handlers

  • shop:on_checkoutSetShippingInfo - sends the shipping address information form to the server for further processing. Use this handler for creating a button, or link, for sending the form data to the server and redirecting the browser to a next checkout step. Example:
    <input 
    	type="image"
    	src="/resources/images/btn_next.gif"
    	alt="Next"
    	onclick="return $(this).getForm().sendRequest('shop:on_checkoutSetShippingInfo')"/>
  • shop:on_updateStateList – allows you to update a list of states when a customer select some country in the country list. Example: 
    <select id="country" name="country" onchange="return this.getForm().sendRequest(
    	'shop:on_updateStateList',
    	{extraFields: {
    		'country': $(this).get('value'),
    		'control_name': 'state',
    		'control_id': 'state',
    		'current_state': '<?= $shipping_info->state ?>'},
    	update: {'shipping_states': 'shop:state_selector'}
    })">
    To make the state list updatable, place it into a separate partial. In the code example above the partial is called shop:state_selector. The parameters control_name, control_id, current_state will be passed into the state list partial by LemonStand when it handles the shop:on_updateStateList request. You can use these parameters in the state list partial to highlight a currently selected state. You can check how the Checkout page organized in the LemonStand demo store.
  • shop:on_copyBillingInfo - copies billing information (a customer name and address) to the shipping information checkout step. Use this for creating a link “Copy billing information” in the shipping information step. Example:
    <a
    	href="#"
    	onclick="return $(this).getForm().sendRequest(
    		'shop:on_copyBillingInfo',
    	{update:{'checkout_page': 'checkout_partial'}})">
    billing information</a>

Next: shop:checkout_shipping_method
Previous: shop:checkout_billing_info
Return to Step-by-step checkout actions