woocommerce_delete_variations_on_product_type_change

woocommerce_delete_variations_on_product_type_change

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter

See hook in core

Displaying hooks found in version: woocommerce.8.7.0

apply_filters('woocommerce_delete_variations_on_product_type_change') is found 1 times:

  • /includes/class-wc-post-data.php line 148
    		 * @param WC_Product $product Product data.
    		 * @return string    $from    Origin type.
    		 * @param string     $to      New type.
    		 */
    		if ( apply_filters( 'woocommerce_delete_variations_on_product_type_change', 'variable' === $from && 'variable' !== $to, $product, $from, $to ) ) {
    			// If the product is no longer variable, we should ensure all variations are removed.
    			$data_store = WC_Data_Store::load( 'product-variable' );
    			$data_store->delete_variations( $product->get_id(), true );
    		}
    	}