Dear Gason
This normally means that the shortcode is being called before all plugins have been loaded.
We can debug at what stage this shortcode is being called from or we can try to use get_post_meta() instead.
// show the out of stock message on shop and category pages add_action( 'woocommerce_after_shop_loop_item_title', 'wcs_stock_text_shop_page', 25 ); function wcs_stock_text_shop_page() { global $product; $availability = $product->get_availability(); //only run if out of stock //if out of stock display message, use class to check as it does not change if ( $availability['class'] == 'out-of-stock') { //get contents of custom field stock message $baba_stock_message = get_post_meta($product->id, "wpcf-baba-stock-message", true); // THIS IS LINE 128 //if stock message custom field empty display default message set with filter above if ( !$baba_stock_message ) { $baba_stock_message = $availability['availability']; } // display message echo apply_filters( 'woocommerce_stock_html', '<p class="stock ' . esc_attr( $availability['class'] ) . '">' . $baba_stock_message . '</p>' ); } }
Please let me know if you are satisfied with my reply and any other questions you may have.
Regards,
Caridad