[ad_1]
How can I show product additional information? before each input?
Input is for send stock to database!
If need more description please sent comment!
This is for storehouse management.
if ($product->is_type( 'variable' ))
echo "<span class='btt'>به ترتیب: </span>";do_action( 'woocommerce_product_additional_information', $product );
// Get the available variations for the variable product
$available_variations = $product->get_available_variations();
// Initializing variables
$variations_count = count($available_variations);
$loop_count = 0;
// Iterating through each available product variation
foreach( $available_variations as $key => $values )
$loop_count++;
// Get the term color name
$attribute_color = $values['attributes']['attribute_pa_color'];
$wp_term = get_term_by( 'slug', $attribute_color, 'pa_color' );
$term_name = $wp_term->name; // Color name
// Get the variation quantity
$variation_obj = wc_get_product( $values['variation_id'] );
$stock_qty = $variation_obj->get_stock_quantity(); // Stock qty
// New Code
$taxonomy = 'pa_color';
$meta = get_post_meta($value['variation_id'], 'attribute_'.$taxonomy, true);
$term = get_term_by('slug', $meta, $taxonomy);
$variation_id = $variation_obj-> get_ID();
$namatt = get_taxonomy($attribute_slug)->labels->name;
// The display
$qytinput = "<input type='text' name='qyt_value' placeholder='";
$qyrinputw = "'>";
echo "<form action='db.php' method='post'>" . $qytinput . $term_name . $stock_qty . $qyrinputw . "<input type='text' name='id_value' value='" . $variation_id . "'>" . "<input class='submit' type='submit' value='ذخیره'></form>";
else
$elsoo = $product->get_stock_quantity();
$elsooo = get_the_ID();
echo "<form action='db.php' method='post'><input type='text' name='qyt_value' placeholder='" . $elsoo . "'><input type='text' name='id_value' value='" . $elsooo . "'><input class='submit' type='submit' value='ذخیره'></form>";
[ad_2]
لینک منبع