Created
December 15, 2016 11:22
-
-
Save WPprodigy/c3dcba75db48e7833d5471dcef48c185 to your computer and use it in GitHub Desktop.
Require bundled product input if it only contains optional products.
This file contains hidden or 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
add_filter( 'woocommerce_bundle_requires_input', 'wc_ninja_require_bundle_input', 10, 2 ); | |
function wc_ninja_require_bundle_input( $requires_input, $product ) { | |
if ( ! $product->contains( 'mandatory' ) && $product->contains( 'optional' ) ) { | |
$requires_input = true; | |
} | |
return $requires_input; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment