shop.modules.shipping

Attributes

Classes

Module Contents

shop.modules.shipping.logger
class shop.modules.shipping.Shipping

Bases: shop.modules.abstract.ShopModuleAbstract, viur.core.prototypes.List

moduleName = 'shipping'
kindName = '{{viur_shop_modulename}}_shipping'
adminInfo()
Return type:

dict

choose_shipping_skel_for_article(article_skel, *, country=None)

Chooses always the cheapest, applicable shipping for an article

Ignores the supplier

Parameters:
  • country (str | None) – Ignore the context and get shipping for this country.

  • article_skel (viur.shop.types.SkeletonInstance_T[viur.shop.skeletons.ArticleAbstractSkel])

Return type:

viur.shop.types.SkeletonInstance_T[viur.shop.skeletons.ShippingSkel] | None | Literal[False]

# TODO(discuss): List all options?

get_shipping_skels_for_cart(*, cart_key=SENTINEL, cart_skel=SENTINEL, country=None, use_cache=False)

Get all configured and applicable shippings of all items in the cart

# TODO: how do we handle free shipping discounts?

Parameters:
  • cart_key (viur.core.db.Key) – Key of the parent cart node, can be a sub-cart too

  • country (str | None) – Ignore the context and get shipping for this country.

  • cart_skel (viur.shop.types.SkeletonInstance_T[viur.shop.skeletons.CartNodeSkel])

  • use_cache (bool)

Returns:

A list of SkeletonInstance`s for the :class:`ShippingSkel.

Return type:

list[viur.shop.types.SkeletonInstance_T[viur.shop.skeletons.ShippingSkel]]