Do not offer to create a new customer account if a membership is required

This commit is contained in:
Raphael Michel
2021-06-07 12:41:03 +02:00
parent 5ee51c8f9a
commit 881f0e04a0
2 changed files with 39 additions and 28 deletions

View File

@@ -254,6 +254,14 @@ class CustomerStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
field.widget.is_required = False
return f
@cached_property
def signup_allowed(self):
return not any(
p.item.require_membership or
(p.variation and p.variation.require_membership)
for p in self.positions
)
@cached_property
def guest_allowed(self):
return not any(
@@ -330,6 +338,7 @@ class CustomerStep(QuestionsViewMixin, CartMixin, TemplateFlowStep):
self.cart_session.get('customer_mode', 'login' if self.request.customer else '')
)
ctx['guest_allowed'] = self.guest_allowed
ctx['signup_allowed'] = self.signup_allowed
if 'customer' in self.cart_session:
try: