Question: Product editing variant cost

Product editing variant cost

Hi, i found an issue while editing a product, while editing there is no field to update cost of the product variant, but the code for editing a product expects a value for cost, since there'

RF

Ricardo Flotte

Asked

Hi, i found an issue while editing a product, while editing there is no field to update cost of the product variant, but the code for editing a product expects a value for cost, since there’s no field for product variant cost, everytime you update a product which the variant already has a cost, the cost will be set to 0.

here’s the code where you get the cost for the variant:

foreach ($product_variants as $pv) {
       $update_variants[] = [
              'id'    => $this->input->post('variant_id_' . $pv->id),
               'name'  => $this->input->post('variant_name_' . $pv->id),
               'cost'  => $this->input->post('variant_cost_' . $pv->id),
               'price' => $this->input->post('variant_price_' . $pv->id),
        ];
 }

also, what’s the purpose of that cost? i read in another question that in the profit you don’t use that cost, instead you use the main product’s cost

  • MS

    Mian Saleem

    Answered

    Hello,

    Variants don’t have any cost addition like price. I will check in future updates.

    Thank you

  • PV

    Prom Vongchann

    Answered

    Mian Saleem did you add this feature? i think it is also important.

  • MS

    Mian Saleem

    Answered

    Prom Vongchann No, it will only be added in the next major update. I have just started working on the rewrite of SMA. Thank you

  • PV

    Prom Vongchann

    Answered

    Mian Saleem Oh, thank you still waiting

  • MS

    Mian Saleem

    Answered

    Prom Vongchann It will take very long as I am starting to setup project and finalising the tech stack. Thanks

  • Login to Reply