If you want to enable or disable specific product data for the variations table you can use the “woocommerce_variations_table_data” filter like below.

In this example for the product ID 565 it has no image (im) and no sku (sk). Instead we added Stock (st) and Dimensions.

function modify_variations_table_data($data) {
	global $product;

	if($product->get_id() == 565) {
		unset($data['im']);
		unset($data['sk']);
		$data['stock_quantity'] = 'Stock';
		$data['di'] = 'Dimensions';
	}
    return $data;
}
add_filter( 'woocommerce_variations_table_data', 'modify_variations_table_data', 10, 1 );

Reference of Variables:

  • ‘im’ => Image
  • ‘sk’ => SKU
  • ‘pr’ => Price
  • ‘st’ => Stock
  • ‘at’ => Attributes
  • ‘ca’ => Add to Cart
  • ‘de’ => Description
  • ‘di’ => Dimensions
  • ‘we’ => Weight

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *