I’ve following code inserted into capabilities.php:
add_filter( 'woocommerce_variation_option_name','display_price_in_variation_option_name');
operate display_price_in_variation_option_name( $time period ) {
world $product;
if ( empty( $time period ) ) {
return $time period;
}
if ($product == null) {
return $time period;
}
$variation_id = $product->get_children();
foreach ( $variation_id as $id ) {
$_product = new WC_Product_Variation( $id );
$variation_data = $_product->get_variation_attributes();
foreach ( $variation_data as $key => $knowledge ) {
if ( $knowledge == $time period ) {
$html = $time period;
$html .= $_product->get_stock_quantity() > 0 ? ' - Quick Supply' : '';
return $html;
}
}
}
return $time period;
}
It has to show ‘Quick supply’ possibility proper subsequent to the scale if the scale in inventory proper now.
Perhaps there is a matter in the way in which I add attributes to the product, as a result of this code works earlier than. Beforehand I added attributes like this:
Then I made a decision to make this attribute world so my search filter works properly. And now I merely select Dimension attribute as a substitute of Create customized attribute possibility.
So my attribute seems to be like this:
And this:
Do you could have some concepts how one can make this code alive?