Disable the Unpublish/Delete product option for vendors

WCMp Vendor Staff

Disable the Unpublish/Delete product option for vendors Resolved

Viewing 27 reply threads
  • Author
    Posts
    • #90801
      Kyriakos
      Participant

      Hello,
      Is there an option available for site admin, to Disable the Unpublish product option and Delete product option?

      So none of the vendors can unpublish or delete any of his published projects.

    • #90833

      Hi @Kyriakos, you can restrict the vendor from editing the published product by disabling “Edit Published Products” via WCMp >> Settings >> Capability.

      This way vendor can’t edit or delete a published product.
      Alternatively, you can also use our option “Publish Products”, this way any changes by the vendor needs approval from the admin.

      Let us know if you need any further help.

    • #90840
      Kyriakos
      Participant

      Hello,
      I only need to Disable the Unpublish product option and Delete product option.

      I want vendors to edit their products, but as soon they (or the admin) publish it, it has NEVER to be unpublished becuase of SEO damage.

    • #90848

      @Kyriakos, if you want to remove the “Draft” option for all the so vendor can’t unpublish the products, then add this css via WCMp >> Settings >> Vendor >> Vendor Frontend >> Custom css :

      .wcmp-action-container input#wcmp_afm_product_draft {
          display: none;
      }
      Copy

      Now to remove the delete option too, add this css via WCMp >> Settings >> Vendor >> Vendor Frontend >> Custom css :

      .col-actions span.trash, span.divider:nth-of-type(4)
       {
          display: none;
      }
      Copy

      However, if you want to remove these options, only for the published product then you have to do custom code and add a checking.

    • #90863
      Kyriakos
      Participant
      This reply has been marked as private.
    • #90873
      This reply has been marked as private.
    • #91654
      Kyriakos
      Participant
      This reply has been marked as private.
    • #92337
      Kyriakos
      Participant
      This reply has been marked as private.
    • #92350
      This reply has been marked as private.
    • #92581
      Kyriakos
      Participant

      Have you read my messages please? The post you send me has NO relation with email functions. Emails are working fine.

      I need to disable a) the UNPUBLISH product option and b) the alias edit option for VENDORS.

      Please ready my previous message.

      Can you please advise for that and if it is some EXTRA Cost customization: When a Vendor re-edit his product has NEVER to be unpublished from him, and NEVER change his URL Product alias again.

      I need to know because if you are not available to fix that, I will ask a developer please.

      Thank you for your response.

    • #92593

      @Kyriakos, the code we shared in the last thread (https://wc-marketplace.com/support-forum/topic/edit-product-pending-review-admin-dont-get-email-bug/#post-88963) will add this flow in your site, let me know if you are looking for something else :
      – Vendor will add a product for the first time
      – Admin needs to approve this
      – Then vendor needs to edit a published product
      – That product will be published automatically, hence no admin approval requires.

      Also, by default vendor can’t edit product’s url.

    • #92818
      Kyriakos
      Participant

      That is really fantastic. So the code is:

      
      /**************  product published after 1st time permission ****************************/
      add_action( 'wcmp_process_product_object', 'approved_vendor_action' , 10 , 2 );
      function approved_vendor_action( $product , $data ){
       if ( $_SERVER['REQUEST_METHOD'] === 'POST' ) {
         if( metadata_exists( 'post', $product->get_id(), 'approved_manually_vendor' ) ){
           $product_value = get_post_meta( $product->get_id(), 'approved_manually_vendor', true );
             if( $product_value == 2 ){
             $post_data = array(
               'ID' => $product->get_id(),
      
               'post_status' => 'publish',
               );
             wp_update_post( $post_data );
           }
         } else{
           update_post_meta( $_POST['post_ID'], 'approved_manually_vendor', 1 );
         }
       }
      }
      
      function save_product_from_admin_end( $post_id ) {
       $product = wc_get_product( $post_id );
       $product->update_meta_data( 'approved_manually_vendor', 2 );
       $product->save();
      }
      add_action( 'woocommerce_process_product_meta', 'save_product_from_admin_end' );
      
      Copy

      Can you please guide me exactly where to place that as an override in order NOT to loose at next plugin update?

      Thank you so much for your response.

    • #92828

      @Kyriakos, you have to add this code in the function.php of the active child theme’s folder.

    • #93017
      Kyriakos
      Participant
      This reply has been marked as private.
    • #93135
      This reply has been marked as private.
    • #93137
      Kyriakos
      Participant
      This reply has been marked as private.
    • #93203
      This reply has been marked as private.
    • #93228
      WCMp Admin
      Keymaster
      This reply has been marked as private.
    • #93268
      This reply has been marked as private.
    • #93286
      Kyriakos
      Participant

      OK! It is now Pulblished without category. It is uncategorized.

    • #93309
      This reply has been marked as private.
    • #93322
      Kyriakos
      Participant
      This reply has been marked as private.
    • #93546

      @Kyriakos, our team is looking into this. I will keep you posted.

    • #93732
      Kyriakos
      Participant

      What is going with that please? The site’s CSS crashed and now I enabled the main theme for that.

      What did you did?

    • #93768

      Sorry for the inconvenience, some code was commented out. We have activated the child theme.

      Also, our team checked this, the product is getting publish when vendor is editing it, as you can see here – https://www.loom.com/share/a8940abec79742ffa907916b181426ae

    • #93774
      Kyriakos
      Participant

      Hello,
      Very thank you for that. It is ok now.

    • #93892
      Kyriakos
      Participant

      Hello,
      One last help about that fuction. Your customization works just great.

      Now we checked at the frontend that when a vendor is logged in, he is able to trash/delete his product with a hover option. Please check image.

      That hover is great, but we need to Disable the Delete/Remove product option please.

      Attachments:
    • #93920

      Hi @Kyriakos, add this css in the style.css of the current active theme :

      span.wcmp_fpm_button_separator, a.wcmp_fpm_button.wcmp_fpm_delete, .wcmp_fpm_buttons {
          display: none;
      }
      Copy
Viewing 27 reply threads

The topic ‘Disable the Unpublish/Delete product option for vendors’ is closed to new replies.

Buy all Marketplace addons together, check out our Bundle

Buy at Slashed Price