Home Forums WoodMart support forum Split: Sticky add to cart replaced with empty space if product out of stock Reply To: Split: Sticky add to cart replaced with empty space if product out of stock

#419591

BoRed
Participant

Hello and thanks for the quick reply!

I did disable all the plugins, the problem was still there.

However, in my search for any custom functions that I might have added that could mess with the sticky add to cart I found a custom function. For some reason adding a custom body class to backorder products will interfere with the sticky add to cart.

My custom function, if anyone needs to check:

 function Custom_backorder_class ($classes) {
  global $post;
  if($post->post_type !="product")
    return $classes;
  $product = wc_get_product( $post->ID );
  if($product->backorders_allowed())
    $classes[] = 'back-order-allowed';
  return $classes;
}
add_filter('body_class', 'Custom_backorder_class');