Skip to content

Instantly share code, notes, and snippets.

@bolderelements
Last active January 27, 2018 02:12
Show Gist options
  • Save bolderelements/d324b791118ce716a8bde6140929a86b to your computer and use it in GitHub Desktop.
Save bolderelements/d324b791118ce716a8bde6140929a86b to your computer and use it in GitHub Desktop.
Restocking Form Override (No Hooks)
<?php
// Add restocking form container
if( class_exists( 'BE_Product_Alerts_Form_Restocking' ) ) {
// check if enabled
$bepa_settings = get_option( 'woocommerce_product-alerts-restocking_settings' );
if( ! is_admin() && $bepa_settings['enabled'] !== 'no' ) {
// check if the single product is out of stock
if( ! $product->is_type( 'variable' ) && ! $product->is_in_stock() ) {
// display form if meets all criteria
$restocking_form = new BE_Product_Alerts_Form_Restocking();
$restocking_form->add_email_form();
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment