Sylius and Promotions - sylius

When adding a promotion you can choose that if cart contains a product you can apply a discount to items in cart.
This way, if you have 5 products in cart and one of them is selected in the rule configuration, all 5 products in cart will have a discounted price.
My question is if this can be modified so only those products selected in the rule will have the discount and not every product you have in cart.
Thank you,

The concept of promotions in Sylius is based on 3 pillars: rules, actions and filters.
rules specify in which case promotion will be applied (in your case it when order contains a specific product) - so they have nothing in common with a discount applied
actions are about what discount is applied - which means how many money/how big percentage of money will be cut of the final price of order/item
filters are about on which items discount will be applied (so they're strictly connected with item-based actions)
So in your case you should specify "Contains product" rule, then add a "Item fixed/percentage discount" action. And if you want to apply discount only on specific product - you must configure "Product filter" with it.
I know it can be a little bit confusing at the first time, but if you think about it's quite good separation of responsibility.
So one more time:
rule - when to apply promotion
action - how big discount is
filter - on which items it's applied
Hope it helped ;)

Related

Accessing automatic discounts in the cart page

I want to render stuff in the cart when a certain automatic buy-x-get-y discount exists, is there a way to access the discounts added in the admin discounts section then check their titles? If not, is there another way I can do so within the cart? Because the only other way I can think of is adding the y item to the cart if the total price >= x then checking the discounts array for the item then remove it if the discount am looking for is not there, its a solution but it requires sending 1, sometimes 2 unnecessary post requests to the database which I want to avoid.

Shopify - auto-tagging by 'compare at price' difference

The shopify store I edit has a 'sale' collection. This consists of products which have been auto-tagged on the condition that the 'compare at price' is higher than the actual price.
I want to create a new 'clearance' section, which would consist of products where the actual price is cheaper than the compare at price by 50% or greater. I can't find a simple way to do this (i.e. by using the inbuilt collection creator).
Can anyone help me out?
Discounts are applied at the checkout, not when browsing a product. That is why the Smart Collection logic has no conditions based on discounts. If I were you I would try and work out how to build a collection "clearance" with conditions that make sense, and then you could create a price rule/discount that would apply to that collection (50% off). It seems like that is the way to go.

How to set custom price for products on the basis of quantity in shopify?

Greetings.
I am working on a eCommerce website based on shopify. And for product I want to set a custom price. For example, The standard price of product is $500 but price will vary if user increased the quantity i.e. On 5 - 10 it will cost $450, On 11 - 15 it will cost $400 and on 20+ quantity it will cost $300.
I have searched module for this and also found a module i.e. https://apps.shopify.com/quantity-breaks. But its working on the basis of "Percent" that I don't need. Because I want to place price manually on the basis of quantity.
So please help me out from this and provide your valuable thoughts on the same.
Thanks in advance.
The way this is generally done in Shopify is to create variants where the option values are the price breaks. You have to modify your theme so that when a Qty > price break is entered the product page selects the variant that corresponds to that price level.
Other than the coding portion of this the main issue becomes inventory management since Shopify treats each variant as a separate inventory item but if you use variants to manage price breaks they are not actually separate items.
I think the easiest way to do this would be with a Shopify App. There are many that have price breaks etc. and they are usually easier to set up than using variants as the price break amounts.

Prestashop Cart Rules (By Fixed Price)

I am using Prestashop 1.6 and my client has recently requested this promotion to be configured.
It looks like Cart Rules / Catalog Rules are the way, but I can't seem to get it.
Here's the scenario:
There are 3 items in CategoryA ($3 each), and 4 items in CategoryB ($4 each). Promotion is "Buy Any 4 # $10". So as long as there are 4 items in total in the cart (regardless of how many qty each from whichever product from whichever category), the price should be $10.
It definitely can't be done via discount amount or discount percentage, as we will not know the total amount of the cart.
Can this be done in the out of the box PS? Or is there any premium module available?
P.S.: I have searched rather long in stackoverflow but seems weird that no one requires this feature? Or did I overlook it in PS?

Need advice in designing tables in SQL-Server

I have a quote that contains items (store in table QuoteItem):
QuoteItemId, QuoteId, ItemId, Quantity etc.
Now, I need to be able to create a group of chosen items in the quote and apply a discount on it.
Well that's simple, I create two more tables:
Group: GroupId, DiscountPercentage
GroupQuoteItem: GroupId, QuoteItemId
Let's say I have 30 items in a quote.
I made a group that contains items 1-20 from the quote and I applied a discount on it.
Now I need to have another group that contains items 10-30, the problem is about those inner 10 items, I need to control whether the discount should apply on the items after the other discount or it should be on the items' base price.
For instance, I am gonna talk about item no. 15 in the quote: QuoteItem.Cost = 100
I applied 1st discount of 10% = 90.
Now I want to apply the second discount, I need to be able to control if the discount should be on the 100 or should be on the 90.
Same is when I have multiple discount groups and when I wanna apply a complex architecture of discounts.
Any assistance will be really appreciated.
I would look into adding a column to the GroupQuoteItem table, GroupQuoteItem.Priority. This column would be used in the query that determines the final price. If you have N discounts with the same, highest priority, they will be stacked atop each other (the order doesn't matter, thanks to associativity of multiplication).
If all of these high-priority discounts are later removed, lower-priority discounts can take their place. This should help you in setting up pretty complex discount structures.
I hope that at least gives you somewhere to start from.
It really depends on your own business rules. Do you want to apply the discounts on the price after discount or on the original price. When you ask questions like this it helps with SAMPLE Data then show us expected results.
This may be one of those rare times in normalization when you want to store data that you could calculate otherwise. So, in QuoteItem, you could have a Cost field and a DiscountedCost field. If they're the same, then you know no discount has been applied, if they are not, then a discount has been applied. By having this field, you would also be able to do comparisons on what the discount is already and whether you want to add the additional discount. In fact, you could also store that number in an ExistingDiscount field.
Why not store a column in the Group table that specifies whether or not the discount can be accumulated with other discounts versus if it must be applied to the base price only? You could name the field something like "ApplyToBasePriceOnly."
Other than that, I agree with JonH that a lot of this logic should be placed in business rules. I think your general database structure looks pretty good.