Woocommerce 11 – Global $product
-
On upgrading to Woocommerce 11 one of my snippets, as below, produced a critical error when viewing a product.
add_filter('woocommerce_product_add_to_cart_text','bbloomer_archive_custom_cart_button_text');
function bbloomer_archive_custom_cart_button_text( $text ) {
global $product;
if ( $product && !$product->is_in_stock() ) {
// code etc
}
}The reason being is that the the first instance of $product is now a string instead of an object. Is this a bug?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.