Use case:
There are resellers/other site which generates leads for your ERPNEXT e-commerce website products/items/. When the user comes from other site to erpnext site for purchase, you should have the ability
(a) to know from which affiliate /sales partner he is coming (may be to give them exact commission or to analyse their performance) i.e. referral code
(b)Give user discount (based on Pricing Rule) on overall purchase i.e. Coupon code
Design :
[A] Sales Partner with unique referral code
Each Sales Partner can have unique referral code as below
[B] Coupon Code Doctype
Coupon Code form will look as below ,Coupon Code will be unique . It will be linked with Pricing Rule for discount calculation based on defined conditions.
Coupon Used count will update , when user will place order on shopping portal.
[C] Shopping cart flow
Potential customer will land to the website with URL as below
http://sellcc.erpnext.com/products/chair?sp=speed&cc=SAVE30
system will save the URL parameters in browser cookie , which will expire in 30 mins ( which sounds a good amount of shopping engagement time on the site).
After adding items to the cart, the cart will look as below
The Coupon Code custom field will be added as below to capture & apply the relevant discount to the user, while the sales partner code will remain hidden (though visible below) .
System will fetch the sales partner , mapped to the (unique) referral code, and will set in the Quotation ( Sales Partner – custom field) & Sales Order ( Sales Partner- field).
Shopping cart view
[D] Impact on Quotation and Sales Order when order is placed
At present , whenever potential customer , clicks on “”Add to Cart” button, in background ERPNext prepares Quotation and updates its line items based on various item additions.
On click of the “Place Order” button , Sales Order gets generated with the relevant details.
So the quotation and sales order with sales partner ( Print Hide) and coupon code information will look as below.
Quotation form
Edit : Pricing Rule is made to overwrite Price List / define discount percentage, based on defined criteria.
Discount section is to provide “Additional Discount” - as the section heading suggest, the "Additional Discount Percentage/ Additional Discount Amount (USD) fields will not be updated
Quotation Line Item will carry the discount information based on pricing rule
Sales Order on Shopping Cart Portal will look as below
Sales Order Form will have the Coupon Code Information
Edit : Pricing Rule is made to overwrite Price List / define discount percentage, based on defined criteria. Hence the Discount Precentage & Discount Amount field will not get updated.
Sales Order Item will carry the discount information based on pricing rule
Sales Order form will have the sales partner information
Looking forward for co-operation on getting this feature merged asap.
Since there are no defined module leaders for shopping cart, I would request the reviewer team (, @rmehta,@nabin ) to review it and give us approval on the same.
At the same time we would request to community members to give us suggestion only by keeping in mind the scope defined in the use case,.
If there are features above the scope request you to raise a different PR with reference to this one.
We wish to merge this within 2 weeks!
Below are the links of earlier discussion on same topic
Issue/ PR : [ADD]shopping_cart_coupon_code: feature of applying price rule on eco… by Solufyin · Pull Request #12559 · frappe/erpnext · GitHub
Discuss Post : How to get affiliate link and URL
Edit : After further analysis, in Quotation, SO.SI form .
Pricing Rule is made to overwrite Price List / define discount percentage, based on defined criteria.
Discount section is to provide “Additional Discount” - as the section heading suggest, so "Additional Discount Percentage/ Additional Discount Amount (USD) fields will not get updated through shopping cart .
Quotation Item and Sales Order Item will carry the discount information based on pricing rule.
Hence changed the screenshots of_
- Quotation Form
- Sales Order Form
- Sales Order on Webportal
Added two new screenshots of
- Quotation Item
- Sales Order Item