Please note that this documentation is for the most recent version of this extension. It may not be relevant for older versions. Related documentation can be found in the documentation directory of the extension.
Discounts
Discounts and other costs that should be deducted can be configured via discounts These are data records that you create in the product container and which are applied to the price (net).
- Label: This is the label for the discount. This label is also used in the shopping basket, the email and the invoice.
- Type: Type controls whether the value should be a fixed value (Fixed price) or a percentage (In percent).
- Only on order option: Specify the type of orders where this discount are added.
- all: Applies to every order.
- on product: This discount can be specified for an individual product. For example, if a product is outdated, a discount can be selected here. This discount will be displayed in product and basket view.
- Request: Applies to all checkouts of type request
- Pre-payment: Applies to all checkouts of type Pre-payment
- On-invoice: Applies to all checkouts of On-invoice
- PayPal: Applies to all checkouts of type PayPal
- PayPal-Checkout: Applies to all checkouts of type PayPal-Checkout
- Klarna: Applies to all checkouts of type Klarna
- Stripe: Applies to all checkouts of type Stripe
- Fixed value: This field is only visible if the Fixed price type is selected. This is the fixed value to be used.
- Value in percent: This field is only visible if the In percent type is selected. This is the percentage that should be used.
Currently only one discount per product possible. The first matching discount wins.
The order is:
- Is a discount in product selected, it will be deducted
- Is a discount in frontend-user selected, it will be deducted after the product discount
- Is a discount for checkout type available
- Is a discount for all order types available
Sequence diagram
sequenceDiagram
Product->>DiscountService: findMatchingDiscount($this->getDiscount())
Note over Product,DiscountService: Gets the product assigned discount,<br />or a discount which is available for all-products
Product->>DiscountService: calculateDiscountAmount($discount, $this->getPrice())
BasketService->>DiscountService: applyDiscount($basketItem, $discount, $checkoutType)
Note right of DiscountService: Text in note
DiscountService-->>DiscountService: findMatchingDiscount($discount, $checkoutType)
State diagram product discount price
stateDiagram-v2
state if_state_product_discount <<choice>>
state if_state_product_discount_and_user_discount <<choice>>
state if_state_user_discount <<choice>>
state if_state_checkout_type_all <<choice>>
[*] --> HasProductDiscount
HasProductDiscount --> if_state_product_discount
if_state_product_discount --> HasUserDiscount: no
HasUserDiscount --> if_state_user_discount
if_state_product_discount --> AddProductDiscount : yes
AddProductDiscount --> HasUserDiscountToo
HasUserDiscountToo --> if_state_product_discount_and_user_discount
if_state_product_discount_and_user_discount --> CheckoutTypeBased: no
if_state_product_discount_and_user_discount --> AddUserDiscountToo : yes
AddUserDiscountToo --> CheckoutTypeBased
if_state_user_discount --> CheckoutTypeBased: no
if_state_user_discount --> AddUserDiscount : yes
AddUserDiscount --> CheckoutTypeBased
CheckoutTypeBased --> HasCheckoutTypeAll
HasCheckoutTypeAll --> if_state_checkout_type_all
if_state_checkout_type_all --> HasOtherCheckoutTypeDiscount : no
if_state_checkout_type_all --> AddCheckoutTypeAllDiscount : yes
AddCheckoutTypeAllDiscount --> [*]
HasOtherCheckoutTypeDiscount --> AddOtherCheckoutTypeDiscount
AddOtherCheckoutTypeDiscount --> [*]