• Resolved matteve

    (@matteve)


    This plugin is ideal for what I need. I added the plugin and then set up 1 product to be dependent on another – it worked perfectly. However when I then tried it with another pair of products my site errored with the following:

    WordPress version 6.3.2
    
    Active theme: Thrive Theme Builder (version 3.28)
    
    Current plugin: Stock Dependencies for WooCommerce (version 1.6)
    
    PHP version 8.0.30
    
    Error Details
    
    =============
    
    An error of type E_ERROR was caused in line 345 of the file mydomain/public_html/wp-content/plugins/wc-stock-dependencies/admin.php. Error message: Uncaught TypeError: intdiv(): Argument #2 ($num2) must be of type int, string given in mydomain/public_html/wp-content/plugins/wc-stock-dependencies/admin.php:345
    
    Stack trace:
    
    #0 mydomain/public_html/wp-content/plugins/wc-stock-dependencies/admin.php(345): intdiv()
    
    #1 mydomain/public_html/wp-includes/class-wp-hook.php(310): StockDependenciesForWooCommerceAdmin\Admin->product_get_stock_quantity()
    
    #2 mydomain/public_html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
    
    #3 mydomain/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-data.php(884): apply_filters()
    
    #4 mydomain/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(364): WC_Data->get_prop()
    
    #5 mydomain/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1393): WC_Product->get_stock_quantity()
    
    #6 mydomain/public_html/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-product.php(1414): WC_Product->validate_props()
    
    #7 mydomain/public_html/wp-content/plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-data.php(424): WC_Product->save()
    
    #8 mydomain/public_html/wp-includes/class-wp-hook.php(310): WC_Meta_Box_Product_Data::save()
    
    #9 mydomain/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    
    #10 mydomain/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
    
    #11 mydomain/public_html/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-meta-boxes.php(273): do_action()
    
    #12 mydomain/public_html/wp-includes/class-wp-hook.php(312): WC_Admin_Meta_Boxes->save_meta_boxes()
    
    #13 mydomain/public_html/wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    
    #14 mydomain/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
    
    #15 mydomain/public_html/wp-includes/post.php(4753): do_action()
    
    #16 mydomain/public_html/wp-includes/post.php(4855): wp_insert_post()
    
    #17 mydomain/public_html/wp-admin/includes/post.php(445): wp_update_post()
    
    #18 mydomain/public_html/wp-admin/post.php(227): edit_post()
    
    #19 {main}
    
      thrown

    Any ideas as I’d love to use this plugin? Thanks

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author KevinMcCall

    (@kevinmccall)

    Can you take a look at the stock dependency that you created for the product that is having the error? Specifically, can you make sure that you have a valid integer value in the quantity field of the stock dependency?

    Thread Starter matteve

    (@matteve)

    Yes it is an integer 60

    Plugin Author KevinMcCall

    (@kevinmccall)

    What is the inventory available for the product or variation on which there is a dependency?

    Are you using any inventory management plugins?

    Thread Starter matteve

    (@matteve)

    Product 1 is a 600 x 400mm sheet of material which is cut from product 2 which is a 1200 x 600 sheet of material.

    Product 2 therefore has a dependency on product 1 (i.e. it is a group of 3 of product 1.

    If I set product 1 to quantity of 60 then product 2 should be 20. I did this for the first set of products and it worked fine. Then I did it for another pair and it failed.

    We are not using any inventory management plugin. We are using Thrive Themes Thrive Architect.

    Plugin Author KevinMcCall

    (@kevinmccall)

    Do you have access to run a query against your database? If so, can you run the following and post the results?

    select * from wp_postmeta where meta_key = '_stock_dependency';
    Thread Starter matteve

    (@matteve)

    {“enabled”:true,”stock_dependency”:[{“sku”:”lamgoldblack600400″,”qty”:”3″}]}

    Plugin Author KevinMcCall

    (@kevinmccall)

    There’s only one row? You mentioned a dependency was added for another product.

    Thread Starter matteve

    (@matteve)

    Yes there had been a dependency saved for 1 product and it worked fine.

    Then I tried to add a second one and got the site error so I had to disable your plugin.

    If I reenable the plugin then my list of products doesn’t display properly and I cannot add any more dependencies

    Plugin Author KevinMcCall

    (@kevinmccall)

    Can you share with me the output from this query:

    SELECT option_name, option_value
    FROM  wp_options
    WHERE option_name LIKE '_transient_sdwc-product-settings%'
    ORDER BY option_name;
    Thread Starter matteve

    (@matteve)

    option_name _transient_sdwc-product-settings-2027option_value {“enabled”:true,”stock_dependency”:[{“sku”:”lamsilverblack600400″,”qty”:””,”product_id”:790}]}

    option_name _transient_sdwc-product-settings-2028
    {“enabled”:true,”stock_dependency”:[{“sku”:”lamgoldblack600400″,”qty”:”3″,”product_id”:754}]}

    Plugin Author KevinMcCall

    (@kevinmccall)

    It’s this one that’s causing the problem:

    option_name _transient_sdwc-product-settings-2027option_value {“enabled”:true,”stock_dependency”:[{“sku”:”lamsilverblack600400″,”qty”:””,”product_id”:790}]}

    It got saved with no value for the dependency quantity (”qty”:””). I’m working on a plugin update that will allow you to clear the plugin’s transients, but in the meantime can you clear that one or all of your DB transients?

    Do you have a plugin for clearing transients from your DB? You can use something like Transients Manager By WPBeginner

    Thread Starter matteve

    (@matteve)

    yes that worked – thanks a lot for your help – really appreciate it ??

    Thread Starter matteve

    (@matteve)

    resolved

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Plugin errored out and I had to diable it’ is closed to new replies.