Advertisement
palsushobhan

allow-only-admin-products-for-add-to-store-feature

May 22nd, 2025
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.57 KB | None | 0 0
  1. add_filter('wcfm_sell_items_catalog_args', function ($args) {
  2.     global $wpdb;
  3.     if (isset($args['author__not_in'])) unset($args['author__not_in']);
  4.     $args['author'] = 1; //change it with the product author ID (admin ID)
  5.     $args['post_status'] = array('publish', 'private');
  6.     return $args;
  7. }, 50);
  8.  
  9. add_filter('wcfmmp_is_allow_single_product_multivendor_by_product', function ($is_allow, $product_id) {
  10.     $product_author = wcfm_get_vendor_id_by_post($product_id);
  11.     if ($product_author) {
  12.         $is_allow = false;
  13.     }
  14.     return $is_allow;
  15. }, 50, 2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement