Skipping the Shipping Method step for downloadable products or 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.
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']);
?>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"/>
Previous: Creating the Order Review partial
Return to AJAX-driven single-page checkout


Comments
Nick Toye
Thursday, January 13, 2011Shouldn't also the Shipping Information be unset also?
Aleksey Bobkov
Thursday, January 13, 2011@nick - yes, you can do it. You can combine this feature with the "Ship to the Billing Address" option, described in this article: http://lemonstandapp.com/docs/implementing_the_the_ship_to_the_billing_address_checkbox_on_the_checkout_page/
Nick Toye
Thursday, January 13, 2011No what I meant was if there is no shipping required, then the Shipping Information shouldn't be visible, it should be Billing and then straight to Payment.
Aleksey Bobkov
Thursday, January 13, 2011@nick - not exactly. The tax calculations are based on the shipping address.
Nick Toye
Thursday, January 13, 2011Good point.
Add your comment
Loading form...