Hi,
I'm using query string parameters to pass a load of stuff through to my checkout page, including discounts.
The query string parameter I am adding is below, but it applies the discount to the first item in the cart rather than the cart as a whole which is what i want. How can I add a cart-wide discount of a fixed amount .. in this case £1.00
&discount_price_amount=Discounts{single|0-1.00}
To see this in action go to the link below. This should take £1.70 off the entire cart, instead it is taking £1.70 off the first product (Nelly blanket)
[url]
https://babblekids.foxycart.com/cart?empty=true&cart=checkout&0:name=Nelly Blanket&0:price=£10.00&0:code=NELLY-C-BL&0:quantity=1&1:name=Blue Polka Dot&1:price=£3.50&1:code=BLUEPOLKADOT-BT-BB&1:quantity=1&2:name=Twit Twoo&2:price=£3.50&2:code=TWITTWOO-BT-BB&2:quantity=1&discount_price_amount=Discounts{allunits|0-1.70}[/url]
Discounts added at the product level (within an add to cart) will only discount that particular product.
A step up from that is category discounts, which apply to all products in the cart that are within that specific category.
You'll want to create a coupon, which will apply to the cart as a whole, for $1.00 off, and then add the coupon with your add to cart, such as "&coupon=COUPONCODE"
Thanks for the update.
Would I be able to vary the value of the discount from the query string with this technique? I'm calculating the correct discount amount myself in my own server code so I'd simply want to pass in whatever the right amount is rather than being dependant on the FC admin settings.
I can see how a coupon would work, but it does not seem like I can control the amount using the query string, but could be wrong!
Ideally I'd rather the discount is shown in the cart summary than being spread across the products.
Thanks
Not with a coupon, no - the coupon's discount is set by it's relevant settings in the admin.
Currently the only way to specify the discount amount within the add to cart is by a product level discount like you were doing. As I mentioned though, those discounts will only apply to that specific product.
Thanks for your help.