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 price (pr), no add to cart (ca) 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);
		unset($data);
		unset($data);
		$data = 'Stock';
		$data = '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.