You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

how_to_configure_shipping.rst 2.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. =========================
  2. How to configure shipping
  3. =========================
  4. Checkout flow
  5. -------------
  6. Oscar's checkout is set-up to follow the following steps:
  7. 1. Manage basket
  8. 2. Enter/choose shipping address
  9. 3. Choose shipping method
  10. 4. Choose payment method
  11. 5. Preview
  12. 6. Enter payment details and submit
  13. Determining the methods available to a user
  14. -------------------------------------------
  15. At the shipping method stage, we use a repository object to look up the
  16. shipping methods available to the user. These methods typically depend on:
  17. * the user in question (eg. staff get cheaper shipping rates)
  18. * the basket (eg. shipping is charged based on the weight of the basket)
  19. * the shipping address (eg. overseas shipping is more expensive)
  20. The default repository is ``oscar.apps.shipping.repository.Repository``, which
  21. has a method ``get_shipping_methods`` for returning all available methods. By
  22. default, the returned method will be ``oscar.apps.shipping.methods.Free``.
  23. Set a custom shipping methods
  24. -----------------------------
  25. To apply your domain logic for shipping, you will need to override
  26. the default repository class (see :doc:`how_to_override_a_core_class`) and alter
  27. the implementation of the ``get_shipping_methods`` method. This method
  28. should return a list of "shipping method" classes already instantiated
  29. and holding a reference to the basket instance.
  30. Building a custom shipping method
  31. ---------------------------------
  32. A shipping method class must define two methods::
  33. method.basket_charge_incl_tax()
  34. method.basket_charge_excl_tax()
  35. whose responsibilies should be clear. You can subclass ``oscar.apps.shipping.base.ShippingMethod``
  36. to provide the basic functionality.
  37. Built-in shipping methods
  38. -------------------------
  39. Oscar comes with several built-in shipping methods which are easy to use
  40. with a custom repository.
  41. * ``oscar.apps.shipping.methods.Free``. No shipping charges.
  42. * ``oscar.apps.shipping.methods.WeightBased``. This is a model-driven method
  43. that uses two models: ``WeightBased`` and ``WeightBand`` to provide charges
  44. for different weight bands. By default, the method will calculate the weight
  45. of a product by looking for a 'weight' attribute although this can be
  46. configured.
  47. * ``oscar.apps.shipping.methods.FixedPrice``. This simply charges a fixed price for
  48. shipping, irrespective of the basket contents.
  49. * ``oscar.apps.shipping.methods.OrderAndItemCharges``. This is a model which
  50. specifies a per-order and a per-item level charge.