Get all bookings/products for a vendor

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 5 reply threads
  • Author
    Posts
    • #45194
      hello4
      Participant

      Hello there,

      What’s the best way to obtain all bookings for the logged in vendor? For WC Product Vendors, I use the following to get product ids first and then retrieve bookings through those:
      //Get all product ids for the logged in vendor
      $product_ids = WC_Product_Vendors_Utils::get_vendor_product_ids();

      Could you kindly help me with the WCMM equivalent to get either all bookings or products for the logged in vendor?

      Many thanks in advance!

    • #45259
      WCFM Forum
      Member

      Hi,

      $product_ids = WC_Product_Vendors_Utils::get_vendor_product_ids();

      Well, this code will give you products, not bookings.

      Which you are looking for products or bookings?

      Well, WCFM has a function like this, that can be use like this –

       global $WCFM;
      $products_list  = $WCFM->wcfm_vendor_support->wcfm_get_products_by_vendor( $vendor_id, apply_filters( 'wcfm_limit_check_status', 'any' ), array( 'suppress_filters' => 1 ) );

      First argument – Vendor ID
      Second Argument – Product Status
      Third Argument – Tweak any argument for WP “get_posts” function – https://codex.wordpress.org/Template_Tags/get_posts, or just do not pass this

      Thank You

    • #45301
      hello4
      Participant

      Hello there,

      Thanks for the reply. What I am trying to do is to get a list of all booking IDs for a given vendor (currently logged in vendor). With WC Product Vendors what I did was: I took all product ids of the vendor first, and then checked all orders ids raised against those items and finally got the booking ids using those order ids.

      I can do the same for WCMM using the function you’ve given but in order to do that, how can I get the vendor id of the currently logged in user? Or is there a quicker way to get all bookings of the logged in vendor?

      Thanks and regards,

    • #45328
      WCFM Forum
      Member

      Hi,

      Just use this code, it will give you logged in vendor’s bookings ids –

      $vendor_bookings = apply_filters( 'wcfm_wcb_include_bookings', '' );

      Thank you

    • #45356
      hello4
      Participant

      It worked! Many thanks!

      Just a suggestion. Maybe you can host a snippets site similar to other plugins on github or somewhere with all these useful code snippets so we can search there before troubling you guys in here.

      Best regards,

    • #45397
      WCFM Forum
      Member

      Hi,

      Great … you are welcome 🙂

      Well, we are already working on that part.

      Thank You

Viewing 5 reply threads
  • The topic ‘Get all bookings/products for a vendor’ is closed to new replies.