Snippets Collections
/**
*   WooCommerce woocommerce_order_item_line_item_html action hook registeration.
*/
add_action('woocommerce_order_item_line_item_html', 'woocommerce_order_item_line_item_html', 1, 3);


/**
* Callback Listener for customised line item functionality in the admin.
*/
function woocommerce_order_item_line_item_html($item_id, $item, $order){
    // Add your custom line item functionality.
    // A good example would be order fulfillment for a line item.
}
add_filter( 'woocommerce_product_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
add_filter( 'woocommerce_product_variation_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
function custom_get_stock_quantity( $value, $product ) {
    $value = 15; // <== Just for testing
    return $value;
}
star

Tue May 31 2022 19:36:45 GMT+0000 (Coordinated Universal Time) https://stackoverflow.com/questions/47611251/any-way-to-overwrite-get-stock-quantity-in-my-functions-php

#wordpress #php #stock #quantity #filter

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension