• Resolved Tim

    (@timothyabgreen)


    Hi Claudio

    Thanks for this plugin, it is exactly what we needed.

    However it appeared to work perfectly for one order and is now not working. We have not updated any other software since installation, we have deactivated and re-activated the plugin but no help.

    We are not getting any errors in the Browser Console or on the Server logs.

    We switched to Twenty Sixteen theme and de-activate all but essential WooCommerce plugins. Still no luck.

    Can you give us any debug tips to check what is going on?

    • This topic was modified 8 years, 1 month ago by Tim.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Claudio Sanches

    (@claudiosanches)

    What are you doing?
    This will reduce stock levels every time that you change an order to “processing” or “complete”.
    Don’t really have anything fancy on it, it’s pretty simple how this plugin works.

    Thread Starter Tim

    (@timothyabgreen)

    Hi

    We are simply adding orders manually in the WooCommerce Admin area when logged in as Shop Manager.

    We change the order to Processing and nothing happens.

    I have a site on a staging server if you would like to see what is going on?

    Plugin Author Claudio Sanches

    (@claudiosanches)

    Try check for other installed plugins, since plugins can remove the filter woocommerce_can_reduce_order_stock and make sure that you have the “Manage Stock” option enabled in WooCommerce and that you are managing stock for all your products in each product settings page.

    Thread Starter Tim

    (@timothyabgreen)

    I can only find reference to this filter in your plugin and WooCommerce itself:

    Searching 3076 files for "woocommerce_can_reduce_order_stock"
    
    <removed for anonymity>/wp-content/plugins/reduce-stock-of-manual-orders-for-woocommerce-master/reduce-stock-of-manual-orders-for-woocommerce.php:
       47  
       48  			// Make sure that is possible to reduce order stock.
       49: 			add_filter( 'woocommerce_can_reduce_order_stock', '__return_true', 999 );
       50  
       51  			// Reduce or increase order stock when changing the order status on the admin screen.
    
    <removed for anonymity>/wp-content/plugins/woocommerce/includes/abstracts/abstract-wc-order.php:
     2625  	/**
     2626  	 * Reduce stock levels for all line items in the order.
     2627: 	 * Runs if stock management is enabled, but can be disabled on per-order basis by extensions @since 2.4.0 via woocommerce_can_reduce_order_stock hook.
     2628  	 */
     2629  	public function reduce_order_stock() {
     2630: 		if ( 'yes' === get_option( 'woocommerce_manage_stock' ) && apply_filters( 'woocommerce_can_reduce_order_stock', true, $this ) && sizeof( $this->get_items() ) > 0 ) {
     2631  			foreach ( $this->get_items() as $item ) {
     2632  				if ( $item['product_id'] > 0 ) {
    
    3 matches across 2 files

    Nothing in the functions.php file either.

    “Manage Stock” option is enabled in WooCommerce.

    We have “Manage stock?” enabled at variations level.

    Any other ideas much appreciated.

    Plugin Author Claudio Sanches

    (@claudiosanches)

    Show me screenshots or a video of your configuration, creating a new order and changing the status to “processing”.

    Thread Starter Tim

    (@timothyabgreen)

    Does this help?
    Screenshots

    Thread Starter Tim

    (@timothyabgreen)

    Hi Claudio

    Were you able to view the screenshots linked above?

    Thanks

    Plugin Author Claudio Sanches

    (@claudiosanches)

    @timothyabgreen the configuration looks fine, but still may have some plugin that is conflicting with it.
    Note that this plugin simple uses WooCommerce functions to do it:

    
    $order = wc_get_order( $order_id );
    $order->reduce_order_stock();
    

    So if this code don’t reduce the stock from the other, can be an issue with WooCommerce or something else making the reduce_order_stock() unable to process it.

    Plugin Author Claudio Sanches

    (@claudiosanches)

    A bug has been found and fixed in version 1.0.1, which should work fine for all orders now.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Debug tips’ is closed to new replies.