Home / Admin / Reset the Product form for all products to ‘Standard’
Duplicate Snippet

Embed Snippet on Your Site

Reset the Product form for all products to ‘Standard’

Code Preview
php
<?php
<?php 
 // reset WC Vendors Product form to standard 
 add_action( 'template_redirect', 'reset_product_form_type' ); 
 function reset_product_form_type(){ 
	$args = array ( 
		'post_type'  => 'product',
		'posts_per_page'  => -1,
		'meta_query' => array( 
				array( 
					'key' => '_wcv_product_form_template', 
					'value' => 'simple'
				), 
			),
	); 
	$product_query = new WP_Query( $args ); 
	foreach (  $product_query->get_posts() as $product_id => $product ) {
		update_post_meta( $product->ID, '_wcv_product_form_template', '' );
	}
 }

Comments

Add a Comment