Sku variations not showing Wordpress / woocommerce

I created a woocommerce store and am adding some options for some products. Each option has its own sku number, but for some reason they do not appear on the product overview panel. Can I add them, or can someone show me the right direction. In addition, if I try to find an option, the displayed product was not displayed. Should I register a variation of sku someere? By default, is this related to woocommerce or not?

Thanks!

enter image description here

Here's how I set the options:

enter image description here

+4
source share
2 answers

, , , : D , , .

class-wc-admin-post-types.php, woocommerce/includes/admin

277

case 'sku' :

    $type = (get_class($the_product));

    if( $type == 'WC_Product_Variable' ){

        $available_variations = $the_product->get_available_variations();

        echo '<strong> Variations: </strong>' . count($available_variations) . '<br><br>';

        for ($i = 0; $i <  count($available_variations); $i++ ) {

            echo ($available_variations[$i]['sku']) . '<br>';
        }
    }
    else {
        echo $the_product->get_sku() ? $the_product->get_sku() : '<span class="na">&ndash;</span>';
    }
break;

- : , , , sku.

, , , .

, - . , !

enter image description here

... , , ... , , 344, .

case 'is_in_stock' :

            $type = (get_class($the_product));

            if( $type == 'WC_Product_Variable' ){

                $available_variations = $the_product->get_available_variations();

                echo '<strong> Variations stock: </strong> <br><br>';

                for ($i = 0; $i <  count($available_variations); $i++ ) {


                    if ( $available_variations[$i]['is_in_stock'] == 0 ) {
                        echo '<mark class="outofstock">' . __( 'Out of stock', 'woocommerce' ) . '</mark>';
                    }else {

                        echo '<mark class="instock">' . __( 'In stock', 'woocommerce' ) . '</mark>';

                    }
                    if ($available_variations[$i]['variation_is_active']) {
                        echo ' &times; ' . $available_variations[$i]['max_qty'] . '<br>' ;
                    }
                }
            } else {

                if ( $the_product->is_in_stock() ) {
                    echo '<mark class="instock">' . __( 'In stock', 'woocommerce' ) . '</mark>';
                } else {
                    echo '<mark class="outofstock">' . __( 'Out of stock', 'woocommerce' ) . '</mark>';
                }

                if ( $the_product->managing_stock() ) {
                    echo ' &times; ' . $the_product->get_total_stock() ;

                }
            }
            break;   

- :

enter image description here

. .   : ... , .

https://github.com/woothemes/woocommerce/issues/9396

+1

IF, HTML SKU meta.php. LINE 18.

WC plugins/templates.

this -> $product->get_sku() IF, .

, IF .

, , , SKU, , . , , , , . , SKU , , .

-1

Source: https://habr.com/ru/post/1611459/


All Articles