Shop_CheckoutData
The Shop_CheckoutData class contains the information, gathered during the checkout process, acting as an internal checkout data storage. This class has methods for programmatic setting the checkout information, like a shipping or payment method, along with a method for creating a new order. It allows you to implement custom checkout scenarios. The default actions for implementing the checkout process use this class internally.
Class methods
- static static get_billing_info() - returns the billing address information as an instance of the Shop_CheckoutAddressInfo class.
- static get_shipping_info() - returns the shipping address information as an instance of the Shop_CheckoutAddressInfo class.
- static copy_billing_to_shipping() - copies the billing address information into the shipping address information, inside the Shop_CheckoutData class.
- static set_shipping_method($shipping_method_id) - sets a specific shipping method. You can use the find_by_api_code() method of the Shop_ShippingOption class for finding a specific shipping option.
- static set_payment_method($payment_method_id) - sets a specific payment method. You can use the find_by_api_code() method of the Shop_PaymentMethod class for finding a specific payment method.
- static set_coupon_code($coupon_code) - sets a specific coupon code. The coupon existence check is not performed.
- static get_cart_id() - returns the shopping cart content identifier saved in the beginning of the checkout process. Comparing the result of this method with the result of the Shop_Cart::get_content_id() allows you to recognize whether the shopping cart content was changed during the checkout process.
- static place_order($customer, $register_customer = false, $cart_name = 'main', $empty_cart = true). Creates an order basing on the checkout information contained by the Shop_CheckoutData class. The checkout information must be prepared in the class by the time of this method call. The method returns an object of the Shop_Order class. Parameters:
- $customer - a currently logged in customer. You can load a customer object from the controller variable: $this->customer
- $register_customer - determines whether a guest customer should be automatically registered by the system
- $cart_name - specifies a cart name to read cart items from
- $empty_cart - determines whether the cart should be emptied after placing the order - shipping_required($cart_name = 'main') - returns TRUE if the shopping cart contains any shippable items (i.e. products belonging to the Goods product type). If the cart contains only downloadable or service-type products the method will return FALSE. Learn how to skip the shipping method step for downloadable products and services here.
Next: Shop_ComparisonList
Previous: Shop_CheckoutAddressInfo
Return to Reference

