Shipping

See How to configure shipping for details on how shipping works in Oscar.

Methods

class oscar.apps.shipping.methods.Base[source]

Shipping method interface class

This is the superclass to the classes in methods.py, and a de-facto superclass to the classes in models.py. This allows using all shipping methods interchangeably (aka polymorphism).

The interface is all properties.

calculate(basket)[source]

Return the shipping charge for the given basket

code = '__default__'

Used to store this method in the session. Each shipping method should

description = ''

A more detailed description of the shipping method shown to the customer

discount(basket)[source]

Return the discount on the standard shipping charge

is_discounted = False

Whether the charge includes a discount

name = 'Default shipping'

The name of the shipping method, shown to the customer during checkout

class oscar.apps.shipping.methods.FixedPrice(charge_excl_tax=None, charge_incl_tax=None)[source]

This shipping method indicates that shipping costs a fixed price and requires no special calculation.

class oscar.apps.shipping.methods.Free[source]

This shipping method specifies that shipping is free.

class oscar.apps.shipping.methods.NoShippingRequired[source]

This is a special shipping method that indicates that no shipping is actually required (eg for digital goods).

class oscar.apps.shipping.methods.OfferDiscount(method, offer)[source]

Wrapper class that applies a discount to an existing shipping method’s charges.

class oscar.apps.shipping.methods.TaxExclusiveOfferDiscount(method, offer)[source]

Wrapper class which extends OfferDiscount to be exclusive of tax.

class oscar.apps.shipping.methods.TaxInclusiveOfferDiscount(method, offer)[source]

Wrapper class which extends OfferDiscount to be inclusive of tax.

calculate_excl_tax(base_charge, incl_tax)[source]

Return the charge excluding tax (but including discount).

Models

class oscar.apps.shipping.models.OrderAndItemCharges(id, code, name, description, price_per_order, price_per_item, free_shipping_threshold)[source]
class oscar.apps.shipping.models.WeightBased(id, code, name, description, default_weight)[source]
class oscar.apps.shipping.models.WeightBand(id, method, upper_limit, charge)[source]

Repository

class oscar.apps.shipping.repository.Repository[source]

Repository class responsible for returning ShippingMethod objects for a given user, basket etc

apply_shipping_offer(basket, method, offer)[source]

Wrap a shipping method with an offer discount wrapper (as long as the shipping charge is non-zero).

apply_shipping_offers(basket, methods)[source]

Apply shipping offers to the passed set of methods

get_available_shipping_methods(basket, shipping_addr=None, **kwargs)[source]

Return a list of all applicable shipping method instances for a given basket, address etc. This method is intended to be overridden.

get_default_shipping_method(basket, shipping_addr=None, **kwargs)[source]

Return a ‘default’ shipping method to show on the basket page to give the customer an indication of what their order will cost.

get_shipping_methods(basket, shipping_addr=None, **kwargs)[source]

Return a list of all applicable shipping method instances for a given basket, address etc.