Hi. How can I show the Price based on pricing riule on Shopping Cart? The function on shopping art to get prices is as follows:
def get_price(item_code, template_item_code, price_list):
if price_list:
price = frappe.get_all(“Item Price”, fields=[“price_list_rate”, “currency”],
filters={“price_list”: price_list, “item_code”: item_code})
if not price:
price = frappe.get_all("Item Price", fields=["price_list_rate", "currency"],
filters={"price_list": price_list, "item_code": template_item_code})
if price:
return price[0]
I want to integrate the “apply_pricing_rule_on_item” on this function. How can I dot it?
is this the function that you are looking for?
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt
erpnext.taxes_and_totals = class TaxesAndTotals extends erpnext.payments {
setup() {
this.fetch_round_off_accounts();
}
apply_pricing_rule_on_item(item) {
let effective_item_rate = item.price_list_rate;
let item_rate = item.rate;
if (in_list(["Sales Order", "Quotation"], item.parenttype) && item.blanket_order_rate) {
effective_item_rate = item.blanket_order_rate;
}
if (item.margin_type == "Percentage") {
item.rate_with_margin = flt(effective_item_rate)
+ flt(effective_item_rate) * ( flt(item.margin_rate_or_amount) / 100);
} else {
item.rate_with_margin = flt(effective_item_rate) + flt(item.margin_rate_or_amount);
}
This file has been truncated. show original
in line 6
I am not sure if that could be used. I just want to show the price based on pricing rule on Shopping Cart.
I can’t get this working. I have seen API of pricing rule and I can’t seem to use it with all the arguments it require. I have already raised an issue on GitHub for this.
hi jeffbangquil, did you get your shopping cart with pricing rule worked? Mine was working before , but this week, for the new added items, the price is not showing. And I did not change set for the items. It is really strange for me.
----it is somehow working now