mirror of
https://github.com/pretix/pretix-servicefees.git
synced 2024-12-24 12:03:08 +01:00
Add option to charge fee on free products (#22)
This commit is contained in:
parent
870999729b
commit
30e55b5b8e
3 changed files with 12 additions and 2 deletions
|
@ -32,7 +32,10 @@ def navbar_settings(sender, request, **kwargs):
|
|||
def get_fees(event, total, invoice_address, mod='', request=None, positions=[], gift_cards=None):
|
||||
if request is not None and not positions:
|
||||
positions = get_cart(request)
|
||||
positions = [pos for pos in positions if pos.price != Decimal('0.00')]
|
||||
|
||||
skip_free = event.settings.get('service_fee_skip_free', as_type=bool)
|
||||
if skip_free:
|
||||
positions = [pos for pos in positions if pos.price != Decimal('0.00')]
|
||||
|
||||
skip_addons = event.settings.get('service_fee_skip_addons', as_type=bool)
|
||||
if skip_addons:
|
||||
|
@ -162,4 +165,5 @@ def order_meta_signal(sender: Event, request: HttpRequest, **kwargs):
|
|||
return meta
|
||||
|
||||
|
||||
settings_hierarkey.add_default('service_fee_skip_addons', 'True', bool)
|
||||
settings_hierarkey.add_default('service_fee_skip_addons', 'True', bool)
|
||||
settings_hierarkey.add_default('service_fee_skip_free', 'True', bool)
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
{% bootstrap_field form.service_fee_per_ticket addon_after=request.event.currency layout="control" %}
|
||||
{% bootstrap_field form.service_fee_skip_non_admission layout="control" %}
|
||||
{% bootstrap_field form.service_fee_skip_addons layout="control" %}
|
||||
{% bootstrap_field form.service_fee_skip_free layout="control" %}
|
||||
{% bootstrap_field form.service_fee_abs addon_after=request.event.currency layout="control" %}
|
||||
{% bootstrap_field form.service_fee_percent addon_after="%" layout="control" %}
|
||||
{% bootstrap_field form.service_fee_skip_if_gift_card layout="control" %}
|
||||
|
|
|
@ -41,6 +41,11 @@ class ServiceFeeSettingsForm(SettingsForm):
|
|||
label=_('Do not charge per-ticket service fee on non-admission products'),
|
||||
required=False
|
||||
)
|
||||
service_fee_skip_free = forms.BooleanField(
|
||||
label=_('Do not charge per-ticket service fee on free products'),
|
||||
help_text=_('Note that regardless of this setting, a per-ticket fee will not be charged if the entire order is free.'),
|
||||
required=False
|
||||
)
|
||||
|
||||
service_fee_abs_resellers = forms.DecimalField(
|
||||
label=_('Fixed fee per order'),
|
||||
|
|
Loading…
Reference in a new issue