Support » Plugin: WooCommerce » Woocommerce- add custom stock status

  • Resolved meenasekar

    (@meenasekar)


    Hi,

    We need to add additional product stock status (Onrequest) on woocommerce product admin end, we can able to edit it on woocommerce core file and it’s working, but we want to override it on our child theme without affecting the source code,

    Kindly, help us to resolve this issue.

    The product stock status code located on the following files:
    file name: woocommerce\includes\wc-product-functions.php
    code:
    =====
    /**
    * Get stock status options.
    *
    * @since 3.0.0
    * @return array
    */
    function wc_get_product_stock_status_options() {
    return array(
    ‘instock’ => __( ‘In stock’, ‘woocommerce’ ),
    ‘outofstock’ => __( ‘Out of stock’, ‘woocommerce’ ),
    ‘onbackorder’ => __( ‘On backorder’, ‘woocommerce’ ),
    );
    }

    file name: woocommerce\includes\admin\list-tables\class-wc-admin-list-table-products.php
    /**
    * Render columm: is_in_stock.
    */
    protected function render_is_in_stock_column() {
    if ( $this->object->is_on_backorder() ) {
    $stock_html = ‘<mark class=”onbackorder”>’ . __( ‘On backorder’, ‘woocommerce’ ) . ‘</mark>’;
    } elseif ( $this->object->is_in_stock() ) {
    $stock_html = ‘<mark class=”instock”>’ . __( ‘In stock’, ‘woocommerce’ ) . ‘</mark>’;
    } else {
    $stock_html = ‘<mark class=”outofstock”>’ . __( ‘Out of stock’, ‘woocommerce’ ) . ‘</mark>’;
    }

    if ( $this->object->managing_stock() ) {
    $stock_html .= ‘ (‘ . wc_stock_amount( $this->object->get_stock_quantity() ) . ‘)’;
    }

    echo wp_kses_post( apply_filters( ‘woocommerce_admin_stock_html’, $stock_html, $this->object ) );
    }

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Woocommerce- add custom stock status’ is closed to new replies.