...
class PickUpInStore(methods.FixedPrice):
code = 'pick-up'
name = 'Pick Up In-Store'
description = "I will pick up my package at: <br> <small><strong>Computer Street 26B </strong></small>"
charge_excl_tax = D('0.00')
charge_incl_tax = D('0.00')
from oscar.apps.shipping.repository import Repository
from oscar.apps.shipping.models import WeightBased
from .methods import *
class Repository(Repository):
def get_available_shipping_methods(self, basket, user=None, shipping_addr=None, request=None, **kwargs):
if shipping_addr: # /checkout/shipping-method/ - Checkout Step 2
weightbased_set = WeightBased.objects.filter(countries=shipping_addr.country.code)
if weightbased_set:
methods = (list(weightbased_set))
methods += [PickUpInStore()]
else:
methods = [Standard()]
else: # /basket/ - Basket page
methods = [Standard()]
return methods
Tested with: Django 5.2 Django-Oscar 4
10 July 2024
|
Last Updated: 02 Dec. 2025
|
jaimedcsilva Related