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 this module. 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 have a unique code.

description = ''

A more detailed description of the shipping method shown to the customer during checkout. Can contain HTML.

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.

calculate(basket)[source]

Return the shipping charge for the given basket

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

This shipping method specifies that shipping is free.

calculate(basket)[source]

Return the shipping charge for the given basket

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

This is a special shipping method that indicates that no shipping is actually required (e.g. 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.

calculate_excl_discount(basket)[source]

Returns the shipping charge for the given basket without discount applied.

property code

Returns the code of the wrapped shipping method.

property description

Returns the description of the wrapped shipping method.

property discount_name

Returns the name of the applied Offer.

property name

Returns the name of the wrapped shipping method.

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

Wrapper class which extends OfferDiscount to be exclusive of tax.

calculate(basket)[source]

Return the shipping charge for the given basket

discount(basket)[source]

Return the discount on the standard shipping charge

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

Wrapper class which extends OfferDiscount to be inclusive of tax.

calculate(basket)[source]

Return the shipping charge for the given basket

calculate_excl_tax(base_charge, incl_tax)[source]

Return the charge excluding tax (but including discount).

discount(basket)[source]

Return the discount on the standard shipping charge

Models

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

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.