onlygoodness LiteCart Fan Fra Netherlands Medlem siden nov. 2020 onlygoodness jan. 18 2025 01:08 p.m. Is there a way to check which payment module is chosen (id) at the checkout so I can use that information to give an error for a minimum subtotal depending on the module?
tim Founder Fra Sweden Medlem siden mai 2013 tim jan. 19 2025 02:41 a.m. In module options(), add the condition: if ($subtotal < 100) { $error = 'Minimum subtotal not reached'; } And return the error with the option: return [ ... 'options' => [ [ .. 'error' => $error, ] ] ]; https://www.litecart.net/en/wiki/how_to_create_a_payment_module
onlygoodness LiteCart Fan Fra Netherlands Medlem siden nov. 2020 onlygoodness jan. 19 2025 12:16 p.m. Thanks Tim, works Perfect! $fee= 0; if ($subtotal < $this->settings['minorder']) { $fee = $this->settings['fee']; } $method = [ 'title' => $this->name, 'description' => language::translate(__CLASS__.':description', ''), 'options' => [ [ 'id' => 'por', 'icon' => $this->settings['icon'], 'name' => reference::country($country_code)->name, 'description' => '', 'fields' => '', 'minorder' => $this->settings['minorder'], 'cost' => $fee, 'tax_class_id' => $this->settings['tax_class_id'], 'confirm' => language::translate(__CLASS__.':title_confirm_order', 'Confirm Order'), ], ] ];