-
-
Save EHLOVader/3227100 to your computer and use it in GitHub Desktop.
Set shipping method automatically in LemonStand
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Default shipping during checkout | |
* This snippet when added to the pre_action will allow you to default shipping selection. | |
* | |
* This is mostly useful when there is only one shipping option, this allows you to skip | |
* the shipping step of checkout entirely, simplifying things for your customers. | |
* | |
* This has been updated to use a dynamic method of pulling the first available shipping | |
* option from your list of available shipping options. | |
* | |
*/ | |
//Check to make sure we are on the shipping_info step. | |
//Shipping info is required for assignment of the shipping option. | |
if(post('checkout_step') == 'shipping_info') | |
{ | |
$available_options = Shop_CheckoutData::list_available_shipping_options(Cms_Controller::get_customer()); | |
if($available_options) | |
{ | |
$indexes = array_keys($available_options); | |
Shop_CheckoutData::set_shipping_method($available_options[$indexes[0]]->sub_options[0]->id); | |
} else { | |
// Shop_CheckoutData::reset_shipping_method(); | |
} | |
} | |
/* End of file pre_action.php */ | |
/* Location: /store_checkout/pre_action.php */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment