如果我的某个变量产品库存不足,我已创建了一条自定义消息。我遇到的问题是,如果我启用了延期交货,它会导致显示消息而不管剩余的数量。我的$ max_qty变量也没有出现在我的自定义消息中。
任何帮助将不胜感激!
foreach( $available_variations as $i => $variation ) {
// Get max qty that user can purchase
$max_qty = $variation['max_qty'];
//check if variation has stock or not
if ( $variation['is_in_stock'] && $max_qty < 5) {
// Prepare availability html for stock available instance
$availability_html = '<p class="stock in-stock" style="font-size: 1em">Hurry only ' . $max_qty . ' spots left on this day and time!' . '</p>';
}
$available_variations[$i]['availability_html'] = $availability_html;
}