Skip to content
Advertisement

Tag: product

Several issues when using woocommerce_get_availability hook

Im trying to show an ‘out of stock message’ on the single product page for products that are out of stock. I have this code in my functions.php I get the following error: Notice: stock was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/plugins/woocommerce/templates/single-product.php’), wc_get_template_part, load_template, require(‘/themes/mytheme/woocommerce/content-single-product.php’), do_action(‘woocommerce_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_single_add_to_cart, do_action(‘woocommerce_simple_add_to_cart’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_simple_add_to_cart,

Advertisement