This is the documentation for LemonStand V1, which has been discontinued. You can learn more and upgrade your store here.

LemonStand Version 1 Has Been Discontinued

This documentation is for LemonStand Version 1. LemonStand is now offered as a cloud-based eCommerce platform.
You can try the new LemonStand and learn about upgrading here.

Configuring a Non-Required Shipping for Digital Products and Services

If you sell downloadable products or service with LemonStand, you may want to hide the Shipping Method step in the checkout process. The approach described below allows to hide the Shipping Method step for cases when a visitor's shopping cart contains only non-shippable items - i.e. products belonging to the Downloadable or Service product types (you can select a product type on the Create/Edit Product page).

Creating the "no shipping required" shipping method

LemonStand requires a shipping method to be assigned for all orders. For orders which contain non-shippable items you need to create a shipping method with zero cost and the no_shipping_required API code. LemonStand will assign this shipping method automatically for non-shippable orders.

Go to the Shop/Shipping Options page and click the Create shipping option button. Select the Table Rate shipping method in the popup window. On the Create Shipping Option page uncheck the Enabled checkbox in order to disable the new shipping option. Disabled shipping options are not visible on the front-end, but API still can use them.

Enter any value to the Name field. In the LemonStand API Code field specify the no_shipping_required value.

Click the Rates tab and specify asterisks in the Country, State and ZIP columns. Enter 0 to the Rate field:

Click the Save button.

 

If modifying the Zest theme, click here to jump to instructions

 

Hiding the Shipping Method link in the checkout progress partial

The shop:checkout action (which handles the checkout process) generates the $shipping_required PHP variable which you can use to hide the Shipping Method step in your checkout progress partial.

In the default store implementation the checkout progress partial has the shop::checkout_progress name. Find this partial on the CMS/Partials page and click it to open the partial editor. The partial code defines an array which keeps a list of the checkout steps. We need to remove the shipping_method element from the array in case if the $shipping_required variable is FALSE. Below is the updated code of the checkout process partial. Please note that we code contains only a part of the partial code. You don't need to change the entire partial code, just add a condition after the $steps array definition:

<?
  // The array definition already exists in the partial
  //
  $steps = array(
    'billing_info' => 'Billing Information',
    'shipping_info' => 'Shipping Information',
    'shipping_method' => 'Shipping Method',
    'payment_method' => 'Payment Method',
    'review' => 'Order Review',
    'pay' => 'Pay',
  );
  
  // Add the following condition to remove the shipping method step
  //
  if (!$shipping_required)
    unset($steps['shipping_method']);
?>
{# The array definition already exists in the partial #}
{%
  set steps = {
    'billing_info': 'Billing Information',
    'shipping_info': 'Shipping Information',
    'shipping_method': 'Shipping Method',
    'payment_method': 'Payment Method',
    'review': 'Order Review',
    'pay': 'Pay'
  }
%}

{# Add the following condition to remove the shipping method step #}
{% if not shipping_required %}
  {% set steps = steps|unset('shipping_method') %}
{% endif %}

Allowing LemonStand to jump over the Shipping Method checkout step

In the end we need to allow LemonStand to jump from the Shipping Info step directly to the Payment Method step. To do that we need to add a hidden field to the checkout form. If you use the default checkout implementation from the LemonStand demo store, you need to update the partial named checkout_partial. Add the following code before the closing FORM tag in the bottom of the partial code:

<input name="auto_skip_shipping" value="1" type="hidden"/>

By default if the auto_skip_shipping hidden field is presented, LemonStand redirects to the Payment Method checkout step. If you set the payment method using API, you can redirect right to the Checkout Review step by adding the auto_skip_to hidden field with the auto_skip_to value:

<input name="auto_skip_to" value="review" type="hidden"/>

Modifying the Zest Theme

In the Zest theme all you have to modify is the ajax function on the "Checkout" page, under the "Ajax" tab called "onSetBillingAndShippignInfo".

Replace that function with the code below:

function onSetBillingAndShippignInfo($controller)
{
  // Save the $_POST variable value for the future use
  //
  $post = $_POST;
  
  // Prepare and set the Billing Information data.
  //
  $_POST = $post['billing'];
  
  try {
    Shop_CheckoutData::set_billing_info($controller->customer);
  } catch (Phpr_ValidationException $ex) {
    $ex->validation->setFirstFocusName('billing[%s]');
    throw($ex);
  } 
  
  // Prepare and set the Shipping Information data.
  //
  $_POST = $post['shipping'];

  try {
    Shop_CheckoutData::set_shipping_info();
  } catch (Phpr_ValidationException $ex) {
    $ex->validation->setFirstFocusName('shipping[%s]');
    throw($ex);
  }
  
  // Move to the next checkout step.
  //
  $_POST['auto_skip_shipping'] = 1;
  $_POST['auto_skip_to'] = "review";
  $_POST['move_to'] = 'shipping_method';
  $controller->action();
  
  if(!$controller->data['shipping_required']){
        $_POST['auto_skip_to'] = null;
        $_POST['auto_skip_shipping'] = null;
        $_POST['move_to'] = null;
        $_POST['checkout_step'] = 'review';
        $controller->action();
  }
}


Previous: Creating an Order Review Page
Return to AJAX-driven single-page checkout