Created
January 26, 2017 12:31
-
-
Save igorbenic/2b5e179592194d95afde316fce507597 to your computer and use it in GitHub Desktop.
WooCommerce Stock Management with other Services | http://www.ibenic.com/woocommerce-stock-management-services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// woocommerce/includes/abstracts/abstract-wc-product.php | |
/** | |
* Returns number of items available for sale. | |
* | |
* @return int | |
*/ | |
public function get_stock_quantity() { | |
return apply_filters( 'woocommerce_get_stock_quantity', $this->managing_stock() ? wc_stock_amount( $this->stock ) : null, $this ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'woocommerce_get_stock_quantity', 'woodev_stock_get_stock_quantity', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_product_options_stock_fields', 'woodev_stock_product_service_field' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'woocommerce_process_product_meta', 'woodev_stock_product_service_field_save' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment