plugin development – Oxygen Builder, Custom Condition Snippet, check stock status of currently selected variation


function my_get_stock_status() {
$post_id = get_the_ID();
$stock = get_post_meta($post_id, "_stock_status", true);
return $stock;

The code above works to check the status of the product, however if the product has variations, and “any of the variations” are in-stock, then the stock status for the product is seen as in-stock, even if one of the other variations are out-of-stock.

I’m trying to modify this snippet to instead, check the stock status of the selected variable on the front end.

Or if thats not completely possible, then i would like to modify it to check the stock status of a specified attribute within the product, for example if I could specify “Blue” as the variation I want to check against, this would work for me too.

Michael 3 weeks 2022-09-06T10:49:40-05:00 0 Answers 0 views 0

Leave an answer