WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
snippet reduce products x woocoomerce 2.0.10 (1 post)

  1. vivithchan
    Member
    Posted 1 year ago #

    Hello,
    I used to insert this snippet code at functions.php from woocommerce to reduce the stock at the checkout, but now after the update from version 2.0.9 to 2.0.10 the snippet creates a conflict with woocommerce, and my page cannot load.
    Is there any possibility to change the snippet code, that I can still reduce the stock at the checkout?

    Here is the code that I use

    add_action( 'wp_footer', 'cs_reduce_stock' );
    /**
     * Reduce stock during checkout.
     *
     * @return void
     */
    function cs_reduce_stock() {
        if ( is_page( woocommerce_get_page_id( 'pay' ) ) ) {
            if ( isset( $_GET['order'] ) ) {
    
                $order_id = (int) $_GET['order'];
                $order = new WC_Order( $order_id );
    
                $order->add_order_note( __( 'Awaiting payment.' ) );
                $order->payment_complete();
            }
        }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    http://wordpress.org/extend/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic