Home Forums Plugins Store Exporter Deluxe [Resolved] Quantity for Variable Products

Welcome to our community support forums! We're here to help - but if you have an urgent request for a Pro Plugin, you will get a prioritised response through our Premium Support page.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #41180
    Lena
    Participant

    ## Posted this before in “Store Exporter” but it should be here:

    Export Type -> Products

    Product Field -> Quantity not showing quantity.

    I assumed that the Product Fields are like:
    Manage Stock = If the stock managing is checked in woocommerce
    Stock Status = If there are Products in stock or the stock is empty
    Quantity = The amount of products in stock

    The last is what I need and when I check there are a lot of products where the quantity is 0 (and should not be when checken in the Woocommerce/Products List)

    It seems that the problem appeares with variation Products, also Sale Price is showing in the Price column and the column Sale Price is empty.

    It looks like

    A-Product SKU B-Product Name C-Product Published D-Price E-Sale Price F-Manage Stock G-Quantity H-Stock Status I-Total Sales J-Product Status
    A-XXXXXX20141001 B-ThisGreatProduct C-11/07/20XX D-55 E- F-Yes G-0 H-In Stock I-16 J-Publish

    but it should show
    A-XXXXXX20141001 B-ThisGreatProduct C-11/07/20XX D-95 E-55 F-Yes G-3 H-In Stock I-16 J-Publish

    When Stock is managed at variation level the quantity shows 0. BUT: In the menu Products-> the column Stock show the calculated amount of all variations stock amounts and also the column Price shows the Price and the Sale Price (which is the same for all variations).

    So is there an option to let Store Exporter Deluxe do the same output like WooCommerce in the Products section, just sum up all variation stock quantities?

    Karim Shehata
    (I am working to solve this issue for Lena)

    #41181
    Lena
    Participant

    Update:

    So even if you set Filter Products by Product Type Variation you get the quantity of every variation but the parent is still 0 but shoud be the sum of all variations in my understanding.

    I had to do some minor alterations, maybe you can consider them in the next update:
    #includes/product.php
    # line 1781 – add a wc product
    function woo_ce_get_product_data( $product_id = 0, $args = array(), $fields = array() ) {
    $_pf = new WC_Product_Factory();
    $wc_product = $_pf->get_product($product_id);

    # ~line 1813 – get the variation prices if it is no single
    if( $wc_product->is_type( ‘variable’ ) ){
    if ($wc_product->get_variation_regular_price(‘min’, false) == $wc_product->get_variation_regular_price(‘max’, false){
    $product->price = $wc_product->get_variation_regular_price(‘min’, true);
    $product->sale_price = $wc_product->get_variation_sale_price(‘min’, true);
    } else {
    $product->price = $wc_product->get_variation_regular_price(‘min’, true).” – “.$wc_product->get_variation_regular_price(‘max’, true);
    $product->sale_price = $wc_product->get_variation_sale_price(‘min’, true).” – “.$wc_product->get_variation_sale_price(‘max’, true);
    }
    } else {
    $product->price = get_post_meta( $product_id, ‘_regular_price’, true );
    $product->sale_price = get_post_meta( $product_id, ‘_sale_price’, true );
    }

    # ~line – get_total_stock works with single and variations
    # $product->quantity = ( function_exists( ‘wc_stock_amount’ ) ? wc_stock_amount( $product->quantity ) : $product->quantity );
    $product->quantity = $wc_product->get_total_stock();

    ####
    With this changes all Prices and Sale Prices and Quantity where shown correct, as single as it was before and as variable product the parent shows the sum of all Variation quantities and the price is also taken from the variations, min – max if the variations have different prices.

    Feel free to use any of this as you with.

    karim.shehata@terravity.com

    – working for Lena ..

    #41834
    Michael Visser
    Keymaster

    Hi Karim, thanks for your contribution, I’ll do some internal testing on the overhead of including the WC_Product_Factory Class as part of our Products export type and have made a task to include a cumulative Quantity value for Variable Products that adds up the sum of Product Variation quantities assigned to them. 🙂

    #42157
    Michael Visser
    Keymaster

    Hi Karim, I’ve got these changes baked into the 2.0.8 Plugin update going out this week 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Quantity for Variable Products’ is closed to new replies.