Viewing 3 reply threads
  • Author
    Posts
    • #1980
      Jason
      Keymaster

      I’m working on an e-commerce site using WooCommerce, and I have a situation where I’d like a metabox (not just a single field) to show up only on a Product post type page wherein the existing Product is a Grouped Product type. Now I know how to check for this, but not how to show/hide the metabox.

      Would this be an occasion to use the piklist_add_meta_box filter? I could add a Product Type: Grouped to the comment data and check for that? I’ll try that, but if there’s another/better way I’d be interested to know what it is!

      Thanks! 🙂

    • #1981
      Jason
      Keymaster

      Hmm.. apparently the $data parameter doesn’t hold unsupported comment data. Perhaps it’d be useful to to support a “custom” line, or else permit extra comment data.

    • #2007
      Steve
      Keymaster

      @jason– We’re thinking about expanding this. Stay tuned!

    • #2022
      Steve
      Keymaster

      In the next version of Piklist you will be able to do this with the piklist_get_file_data filter:

      EXAMPLE:
      Allow Piklist to read “User ID” in comment block

      add_filter('piklist_get_file_data', 'allow_user_id', 10, 2);
      function allow_user_id($data, $type)
      {
        // If not a User section than bail
        if($type != 'users')
        {
          return $data;
        }
      
        // Allow the comment block to read the "User ID" attribute.
        $data['user_id'] = 'User ID';
      
        return $data;
      }
      
Viewing 3 reply threads
  • The topic ‘Conditional Metabox’ is closed to new replies.