Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter( 'woocommerce_cart_product_subtotal', 'modify_cart_product_subtotal', 10, 4 );
- function modify_cart_product_subtotal( $product_subtotal, $product, $quantity, $cart ) {
- if ( $product->get_stock_quantity() < $quantity ) {
- return $product->get_stock_quantity() * $product->get_price();
- }
- return $product_subtotal;
- }
Add Comment
Please, Sign In to add comment