Add below code in your current theme’s functions.php file.
You have to replace USER ROLE with your user role name in if condition.
function check_edit_post($post_id){
global $post;
if( in_array('USER ROLE', wp_get_current_user()->roles) && 'product' == get_post_type($post_id) && 'publish' == get_post_status($post_id) && $post->post_date != $post->post_modified ){
wp_update_post(array(
'ID' => $post_id,
'post_status' => 'draft'
));
}
}
add_action( 'save_post', 'check_edit_post' );
Hope this will helps you.
Related Posts:
- Restrict the shop_manager role to the WooCommerce Orders Page
- Pass custom Checkout field value to Stripe gateway in WooCommerce
- woocommerce fail to replace template string in email title [closed]
- WooCommerce Shop Page Not Found 404
- How can I show an empty WooCommerce cart? [closed]
- Woocommerce : How to attach an custom attachment with customer-processing-order.php email template [closed]
- Woocommerce Pre Orders – Can i override templates?
- Woocommerce checkout via external page [closed]
- Change font size in products listing pages in woocommerce
- Programmatically adding product attributes to WP / Woo commerce
- Display File Types For Woocommerce Downloadable Products On Product Page
- Trying to disable slider for WooCommerce price filter [closed]
- Apply Additional Discount after coupon
- Is it possible to add a sidebar to Storefront’s Welcome page
- Programmatically setting Woocommerce product price
- Woocommerce reviews xss issue [closed]
- Woocommerce REST API allow normal users make an order
- WooComerce shows blank site (Shop)
- How to update custom field in WooCommerce
- Add product categories to receipt
- Woocommerce specific product template for product type
- How can I use a gravity form to send an e-card?
- How to select default Woocommerce category page
- Creating Product Table using Gutenberg
- I can ‘t display product images based on the label
- SKU for each product on every page
- Woocommerce get billing state manually
- Timber, Twig, and Woocommerce: Last product stays in the cart after checkout
- Woocommerce Cart Default Language Not Changing
- Make this Fast and Queryable
- WooCommerce slider filter for numerical attributes
- Woocommerce Update Causing Internal Server Error [closed]
- create custom layout product list woocommerce [closed]
- Reordering product tab under product image [closed]
- How do I change the default state label for a country on the WooCommerce checkout page?
- remove default pagination on woocommerce shop page
- WooCommerce Tax Filter Not Fired [closed]
- woocommerce – customise notice error in checkout page
- Using a filter to change a path
- Woocommerce, prevent login after registration and redirect to custom URL
- Order with custom order status disappeared once the page is refreshed
- WooCommerce Product detail page: Add content under thumbnails [closed]
- How to add product filter dropdown in woo commerce order page?
- Unable to paste google analytics con header.php [closed]
- wordpress/woocommerce login url not redirecting correctly
- Problem while adding the variable product woocommerce
- Woocommerce pre_get_posts query variation meta data not working
- Can’t hide product attributes with css on WooCommerce Product Page
- Updating product image
- Split in 2 columns add to cart button and variable forms
- Images not uploading on product page of woocommercr
- How to access WC()->cart in CF7 hook wpcf7_special_mail_tags
- How to integrate e-transfers with checkout in WooCommerce
- Woocomerce Edit source code of form in wordpress
- Single Product Page as a Popup
- Woocommerce to get restaurant table numbers in the checkout fields from the url
- Send all emails to Shop Manager along with admin
- UX Builder not loading for product description edits
- I need help with storefront theme shop page
- Woocommerce redirection product_name -> product_cat/product_name
- Woocommerce shop page not showing all products
- Wrong Billing Information in WC_Checkout->get_checkout_fields(‘billing’)?
- How to display two different custom taxonomy terms on a WooCommerce single product page
- Registration roles
- why my price is not showing while adding new product?
- How to send Woocommerce Customer Details (Name, Email and Phone Number) to Admin upon signup
- Sending billing details via POST request to an API
- how can my customers view their purchased products history like an invoice in a specific page on WordPress
- How do I make my products on the homepage responsive?
- Remove username and account password field from checkout page
- How to send an invoice with details to the customers
- Tax exclusive if coupon applied else tax inclusive in items
- WooCommerce Registration, Sync User, Billing and Shipping info
- How to change “add to basket” button text in WooCommerce based on product category?
- Select all product woocommerce
- Woocommerce REST API: creating variations
- How to customize product at cart page
- WooCommerce Storefront site-header padding
- How to check which shortcode is using my template?
- woocommerce: when adding or removing items to cart , it takes cart a few seconds to read changes?
- How to get woocommerce integration instance?
- Create woocommerce order on new user registration
- How to put a date range in a virtual/downloadable product? [closed]
- When to use a child theme for WooCommerce Storefront?
- WooCommerce: Bulk Quantity in Cart
- Redirect whole website or pages to /wp-admin in wordpress
- Changing sale price programmatically, but it’s not shown on front-end
- Remove Span Class From Woocommerce Price
- Woocommerce shows empty columns [closed]
- Product atributes in title of order (not in description)
- How to create custome pdf file of my invioice in wordpress
- How to get sub items of parent menu item?
- WordPress and WooCommerce How to Assign Attribute Based Pricing
- unable to get product by category only getting product added lastly
- Storefront Child Theme show product attribute [closed]
- Add Additional 3 buttons next to “Add to cart” button in woocommerce product page
- How do I remove the recurring total from thank you for your order email?
- Woocommerce product and category in url [closed]
- Display product categories + child-categories on a single product page
- I want to Display custom woocomerce meta box in orders list