Discounts Twig functions¶
Discounts Twig Functions allow you to operate on discounts in your templates.
Filters¶
ibexa_render_discount_rule_type¶
This filter transforms the discount type (fixed_amount or percentage) into a human-friendly and translated label.
1 2 3 4 5 6 7 8 | |
Functions¶
ibexa_discounts_render_discount_badge()¶
Use the ibexa_discounts_render_discount_badge to render a badge indicating the discounted amount, for example on product cards.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
ibexa_get_original_price()¶
Displays the product price before the discount was applied.
1 | |
ibexa_format_discount_value()¶
Formats the discount value for each discount type, for example by displaying -10 EUR or -10%.
1 | |
ibexa_discounts_is_active()¶
Helper function returning whether the discount is currently active.
1 2 3 | |
ibexa_discounts_form_themes()¶
The ibexa_discounts_form_themes function serves as an extension point to provide new form themes for the discount form.
To add new ones, create a class implementing the FormThemeProviderInterface interface and provide them in the getFormThemes method.
ibexa_discounts_can_edit()¶
Helper function returning whether the current user has permissions to edit discounts.
ibexa_discounts_can_enable()¶
Helper function returning whether the current user has permissions to enable discounts.
ibexa_discounts_can_disable()¶
Helper function returning whether the current user has permissions to disable discounts.
ibexa_discounts_can_delete()¶
Helper function returning whether the current user has permissions to delete discounts.