PrestaShop: how to create a CartRule that applies discount to shipping -
i'm creating cartrule able apply discounts specific costumers. these discounts being applied order. problem don't know how apply discount in shipping fee. can cartrule ? if not, can use achieve this?
here how i'm creating cart rule. piece of code in in controller inside backoffice (admin)
$cart_rule = new cartrule(); $cart_rule->id_customer = 2; $cart_rule->name = array( configuration::get('ps_lang_default') => $this->l('cartrule title') ); $cart_rule->date_from = date('y-m-d h:i:s', time()); $cart_rule->date_to = date('y-m-d h:i:s', time() + 24 * 3600); $cart_rule->quantity = 1; $cart_rule->quantity_per_user = 1; $cart_rule->minimum_amount_currency = $id_currency; $cart_rule->reduction_currency = $id_currency; $cart_rule->free_shipping = true; $cart_rule->reduction_amount = 10; #discount value $cart_rule->active = 1; $cart_rule->add();
Comments
Post a Comment