• Resolved kajetanza

    (@kajetanza)


    <h2 data-start=”270″ data-end=”387″></h2>

    When using Stock Locations for WooCommerce, <strong data-start=”691″ data-end=”751″> the plugin updates <code data-start=”721″ data-end=”736″>_stock_status to <code data-start=”740″ data-end=”749″>instock, even though WooCommerce core would correctly use <code data-start=”802″ data-end=”815″>onbackorder.

    <h3 data-start=”964″ data-end=”986″>Steps to reproduce</h3>
    1. Create a <strong data-start=”1000″ data-end=”1018″>simple product (same applies to variations).

    2. Enable <strong data-start=”1059″ data-end=”1075″>Manage stock.

    3. Set:

      • Stock quantity = <code data-start=”1107″ data-end=”1110″>0

      • Backorders = <code data-start=”1129″ data-end=”1136″>Allow (or <code data-start=”1141″ data-end=”1169″>Allow, but notify customer<span style=”background-color: initial; font-size: inherit; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;”>)</span>

    4. Enable <strong data-start=”1181″ data-end=”1216″ style=”font-size: inherit; background-color: initial; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;”>Stock Locations for WooCommerce<span style=”font-size: inherit; background-color: initial; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;”>.</span>
    5. Select a stock location (or rely on default logic).

    6. Trigger stock evaluation (shop loop, product page, etc.).

    (plugin ver. 3.0.6)

    This happens in slw_woocommerce_product_is_in_stock()

    Specifically:

    if ($instock_status && $product_id) {update_post_meta($product_id,'_stock_status','instock');}

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter kajetanza

    (@kajetanza)

    I will try again for better formatting…

    When using Stock Locations for WooCommerce, the plugin updates _stock_status to instock, even though WooCommerce core would correctly use onbackorder.

    Steps to reproduce

    1. Create a simple product (same applies to variations).
    2. Enable Manage stock.
    3. Set:
      Stock quantity = 0
      Backorders = Allow or Allow, but notify customer
    4. Enable Stock Locations for WooCommerce.
    5. Select a stock location (or rely on default logic).
    6. Trigger stock evaluation (shop loop, product page, etc.).

    (plugin ver. 3.0.6)

    This happens in slw_woocommerce_product_is_in_stock()

    Specifically:

    if ($instock_status && $product_id) {update_post_meta($product_id,’_stock_status’,’instock’);}

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Line 1175 & 1185 are actually turning this flag true, can you please record a video so I can exactly see your scenario?

    Thread Starter kajetanza

    (@kajetanza)

    In a scenario with product variations and no default location set (ie. $location_id evaluates to false in line 1160) the flag is set to true with line 1166 (managed stock and backorders allowed). This later causes line 1201 to change stock status to instock even though correct would be backorder.

    Similarly, for simple products, but $location_id false, line 1185 is skipped and line 1191 flips $instock_status to true as above.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    So even if we set the following on line 1135 still it will get flip?
    $instock_status = false;

    Thread Starter kajetanza

    (@kajetanza)

    that’s my understanding

    if $type = ‘simple’ (line1149), $location_id = false (line 1181), $product->get_manage_stock()= true, $product->get_backorders() !’= ‘no’ (both in line 1191) then $instock_status = true (lines 1189-1195)

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Try that in your files and let me know if you get the accurate results?

    Thread Starter kajetanza

    (@kajetanza)

    I have just tried that and it doesn’t fix the issue. A product that was onbackorder (0) has changed to instock (0)…

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    I would suggest you to use contact developer option under the help tab on the settings page.

Viewing 8 replies - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.