WooCommerce Products Toggle Lock Status [Blocked by SuperAdmin]

I am wanting to change the permissions of specific WooCommerce products which allows other users to modify the products respectively. Currently I have an option to enable Unlock/Lock the Post Status for Pages/Posts, but not for WooCommerce products.

Please advise.

  • Vaughan

    Hi Justin,

    Hope you're well?

    The Lock function in New Blog templates only works for posts & pages.

    I haven't tried this at all, but hopefully, the following might work.

    Open up & edit the following file:


    Find the following:

    private $_lock_types = array(

    Add 'product' to the array so it looks like:

    private $_lock_types = array(

    Hopefully, that should allow you to lock a product status.

    Hope this helps

  • Justin

    Thanks Vaughan!

    That has enabled the feature to unlock the product post for each product, however in order to unlock each product I have to go through each individual product to change the "Locked Status". Are you aware of a potentially quicker more efficient way to modify bulk products to unlocked status?

    Either some option within Wordpress or by batch updating a flag within the database maybe?

  • Vaughan


    Apologies, for a moment I forgot we was talking about NBT lock status, I dunno why, but I went looking how my post status plugin stores data in the DB.

    Try adding the following to a mu-plugin:

    Create a file called nbt_custom_product_lock.php

    Add the following code:

        add_action('init', 'SBT_set_product_lock');
        function SBT_set_product_lock() {
            $blogID = 2; // set this to the blog_id you want to change
            $lock = false; // set this to true if you want to lock the product.
            $posts = get_posts(
                        'numberposts' => -1,
                        'post_type' => 'product',
            foreach($posts as $p) {
                if(!get_post_meta($p->ID, 'nbt_block_post', true) && $lock) {
                    add_post_meta( $p->ID, 'nbt_block_post', true );
                } elseif (get_post_meta($p->ID, 'nbt_block_post', true) && !$lock) {
                    delete_post_meta( $p->ID, 'nbt_block_post' );
                } else {}

    Upload this to /wp-content/mu-plugins

    set $blogID to the id of the blog you want to change.
    set $lock to true if you want it to lock all products, false if you want to unlock all

    Then visit the front of your site.

    Be sure to remove the file or change the extension from .php to .tmp or delete the file afterwards, or it will keep changing the lock even if you manually changed it in admin.

    I would recommend that you take a backup of your site before proceeding.

    Hope this helps

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.