• Resolved rosalitoudtohan

    (@rosalitoudtohan)


    I need to update / increment the stock quantity on csv import and not just replacing them. Ex. If a current attribute has a 2 stocks, and on the csv import file has 3, then the updated stock should be 5 and not 3. Is there a way to do this?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Mewz

    (@mewz)

    Hi @rosalitoudtohan,

    Please update to the latest version 1.9.3 and add this code snippet to your site. It will add any quantities from your imported CSV file instead of replacing them.

    add_filter('mewz_wcas_import_data', function($data, $stock, $row) {
        if (isset($data['quantity']) && $stock->exists()) {
            $data['quantity'] += $stock->quantity();
        }
    
        return $data;
    }, 10, 3);

    Keep in mind you only need a title or sku column and a quantity column in your CSV file if you’re just updating stock quantities.

    Thread Starter rosalitoudtohan

    (@rosalitoudtohan)

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Update / increment stock quantity on import’ is closed to new replies.