This plugin provides basic refunds functionality for Sylius application.
📖 Full documentation is available here: 👉 Refund Plugin Documentation
If you need to add custom refund types (e.g., fees, commissions), you can extend the RefundType class:
- Create your custom RefundType class:
<?php
declare(strict_types=1);
namespace App\Model;
use Sylius\RefundPlugin\Model\RefundType as BaseRefundType;
use Sylius\RefundPlugin\Model\RefundTypeInterface;
class RefundType extends BaseRefundType implements RefundTypeInterface
{
public const ORDER_FEES = 'commission';
public static function commission(): self
{
return new self(self::ORDER_FEES);
}
}- Create your custom Doctrine RefundEnumType:
<?php
declare(strict_types=1);
namespace App\Doctrine\Type;
use App\Model\RefundType;
use Sylius\RefundPlugin\Entity\Type\RefundEnumType as BaseRefundEnumType;
use Sylius\RefundPlugin\Model\RefundTypeInterface;
class RefundEnumType extends BaseRefundEnumType
{
protected function createType(string $value): RefundTypeInterface
{
return new RefundType($value);
}
}- Configure your application to use the custom classes:
# config/packages/sylius_refund.yaml
imports:
- { resource: "@SyliusRefundPlugin/config/parameters.php" }
parameters:
sylius_refund.refund_type: App\Model\RefundType
sylius_refund.refund_enum_type: App\Doctrine\Type\RefundEnumType- Clear the cache:
php bin/console cache:clearNow you can use your custom refund type in templates and business logic.
If you think that you have found a security issue, please do not use the issue tracker and do not post it publicly.
Instead, all security issues must be sent to security@sylius.com.
For online communication, we invite you to chat with us and other users on Sylius Slack.
This plugin is released under the MIT License.
