Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author algol.plus

    (@algolplus)

    hi Marco

    >WooCommerce>Phone Orders>Settings>Common,
    option “Set status for created order” = what value?

    the stock is updated for these statuses only.
    thanks. Alex

    add_action( 'woocommerce_payment_complete', 'wc_maybe_reduce_stock_levels' );
    add_action( 'woocommerce_order_status_completed', 'wc_maybe_reduce_stock_levels' );
    add_action( 'woocommerce_order_status_processing', 'wc_maybe_reduce_stock_levels' );
    add_action( 'woocommerce_order_status_on-hold', 'wc_maybe_reduce_stock_levels' );
    • This reply was modified 4 years, 3 months ago by algol.plus.
    • This reply was modified 4 years, 3 months ago by algol.plus.
    Thread Starter roymarco

    (@roymarco)

    Hi Alex,

    Perfect! Ok it’s working well.

    Thanks (merci beaucoup) *****

    Marco

    Plugin Author algol.plus

    (@algolplus)

    you’re welcome

    Hi,

    Can I piggyback on this?

    We added this line to the theme functions.php file:

    add_action( 'woocommerce_order_status_pending', 'wc_maybe_reduce_stock_levels' );
    plus some other custom statuses.

    Creating manual orders through WC itself works (and reduces the stock) but doing the order through this plugin doesn’t trigger this.

    Can you help?

    Thanks.

    Plugin Author algol.plus

    (@algolplus)

    Hi

    “pending” is default status for new order, so we don’t start this action.

    but you can use

    add_action( 'wpo_order_created', function($order, $cart) {
    	if($order->get_status() == "pending")
    		wc_maybe_reduce_stock_levels($order->get_id());
    },10,2);
    • This reply was modified 3 years, 10 months ago by algol.plus.

    Hi,

    That looks to have worked.

    Many thanks. ??

    Plugin Author algol.plus

    (@algolplus)

    you’re very welcome

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Inventory not updating’ is closed to new replies.