-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If a giftcard is bought with a coupon code it affects its value #116
Comments
Thanks, @lamasfoker |
SolutionUse Then create a Decorator for the App\Promotion\Filter\ProductFilterDecorator:
decorates: sylius.promotion_filter.product The Decorator looks like that: namespace App\Promotion\Filter;
use App\Entity\Order\OrderItem;
use Sylius\Component\Core\Promotion\Filter\FilterInterface;
use Sylius\Component\Core\Promotion\Filter\ProductFilter;
class ProductFilterDecorator implements FilterInterface
{
protected ProductFilter $original;
public function __construct(ProductFilter $original)
{
$this->original = $original;
}
public function filter(array $items, array $configuration): array
{
$filtered = $this->original->filter($items, $configuration);
return array_filter($filtered, static fn (OrderItem $orderItem) => !$orderItem->getProduct()->isGiftCard());
}
} This filters all Gift Cards from getting promotions. |
Thanks for your solution here, @tuxes3. I really like it and I think we should implement this decorator in the plugin and add a few lines to the readme explaining this. However, what do you think about also adding an 'out of box' solution like so:
This would be kind of a 'seat belt' solution. What do you think? cc @igormukhingmailcom @Roshyo |
Btw. we also have the rule |
I would rather go for something to allow buying a discounted GiftCard. I mean, I can easily imagine scenario where we want to sell 5% discounted GC (buy a 100€ GC for 95€) and this has to be handled correctly. |
@loevgaard not bad of an idea, but be sure to only not process the promotions which cannot be filtered. So only show the error on the promotion @Roshyo I'm not sure about that, this is not possible in the moment as the gift card amount is set of the order item unit total, which subtracts all adjustments made. Furthermore I'm not sure if that would work legally for taxation. |
Step to reproduce
Expected result
In admin I have to se a new giftcard with the amount of 500€
Actual result
In admin I see a new giftcard with the amount of 250€
The text was updated successfully, but these errors were encountered: