Custom stock status issue | WordPress.org

[ad_1]

This seems solution both for google and facebook plugins.

// Check if the function from Facebook for woocommerce plugin exists
if ( class_exists( 'WC_Facebookcommerce_Integration' ) )
add_filter( 'facebook_for_woocommerce_integration_prepare_product_data', 'adjust_facebook_availability_for_eol_products', 10, 2 );

function adjust_facebook_availability_for_eol_products( $product_data, $product )
if ( 'EOL' === $product->get_stock_status()

// Check if the function from Google for woocommerce plugin exists
if ( function_exists( 'woocommerce_gla_product_attribute' ) )
add_filter( 'woocommerce_gla_product_attribute', 'adjust_google_availability_for_eol_products', 10, 3 );

function adjust_google_availability_for_eol_products( $value, $product, $attribute )
if ( 'availability' === $attribute ) 'EOL' === $product->get_meta( '_stock_status' ) )
$value="out of stock";


return $value;

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer