diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5384ef377d5..911f74063cc 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1789,6 +1789,9 @@ class Commande extends CommonOrder $this->line->total_localtax2 = (float) $total_localtax2; $this->line->total_ttc = (float) $total_ttc; $this->line->special_code = $special_code; + if (empty($qty) && empty($special_code)) { + $this->line->special_code = 3; + } $this->line->origin = $origin; $this->line->origin_id = $origin_id; $this->line->fk_parent_line = $fk_parent_line; @@ -3150,8 +3153,11 @@ class Commande extends CommonOrder if (empty($remise_percent)) { $remise_percent = 0; } - if (empty($special_code) || $special_code == 3) { - $special_code = 0; + if (empty($qty) && empty($special_code)) { + $special_code = 3; // Set option tag + } + if (!empty($qty) && $special_code == 3) { + $special_code = 0; // Remove option tag } if (empty($ref_ext)) { $ref_ext = '';