You can absolutely influence the product price on the order line and you don't have to set up a definition to do so, although it would make sense if you want to lock in the values the customer can select.
It's not possible to override the price on an order line from XSLT so you'll have to do a bit of .NET to get there. Here's an example of how to do it:
// Get basket var basket = TransactionLibrary.GetBasket().PurchaseOrder; var orderLine = basket.OrderLines.SingleOrDefault(x => x.Sku == "MySKu" && x.VariantSku == "MyVariantSku");
// Set the price of the order line orderLine.Price = 100m;
basket.Save();
// Execute basket pipeline to tally the new totals TransactionLibrary.ExecuteBasketPipeline();
Already implemented using product variants but that is very useful to know. Many of our clients are charities and they'll want to add donation amounts. Having a text input instead of a dropdown might be ideal for some clients.
Never occurred to me that just changing the price of the order line would do anything... Thanks for the help Soren, again!
How to create a donation product which price is chosen by customer?
In the uCommerce template store there's a Software product definition with a license data type.
How do I create a donation amount data type and can I influence the product price automatically?
Also, how is it possible to add the donation amount to "Add to basket" button using XSLT?
Hi Fabio,
Catalog Foundation Explained: Product Definitions explains how to set up definitions and data types. The Catalog Structure overview video explains some of the same concepts, but in video form obviously :)
You can absolutely influence the product price on the order line and you don't have to set up a definition to do so, although it would make sense if you want to lock in the values the customer can select.
It's not possible to override the price on an order line from XSLT so you'll have to do a bit of .NET to get there. Here's an example of how to do it:
Hope this helps.
Already implemented using product variants but that is very useful to know. Many of our clients are charities and they'll want to add donation amounts. Having a text input instead of a dropdown might be ideal for some clients.
Never occurred to me that just changing the price of the order line would do anything... Thanks for the help Soren, again!
No problem.
Could you explain how a recurring donation to be executed or developed?
is working on a reply...