• Resolved svaldesm

    (@svaldesm)


    Hi Eva, how are you?

    I was wondering if it’s possible to add private products to the feed.
    We publish them the day before and release them on the same day after some quality checks. That would be great, because we can then use those same products as soon as they’re available for other sources.

    Is that possible?

    Thanks!

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi svaldesm,

    I am fine, thanks. Hope you had wonderful holidays too.

    Unfortunately the plugin only retrieves published products and there is no way around this. Allowing private products to make it to product feeds would cause a lot of issues for users so we do not plan on allowing this either.

    All the best,
    Eva

    Thread Starter svaldesm

    (@svaldesm)

    Hi Eva,

    Is there a workaround that I can do to make that work, maybe tuning the code? I know that would get replaced with any plugin update, but as far as you know, is there a way to make that happen?
    Our use case probably is very specific and not similar to other customers, so it won’t make much sense to add it to the feed.

    Thanks,

    Santiago

    Hi Santiago,

    In the class-get-products.php script of the plugin you’ll find this on line 1755:

    
    // Construct WP query
    $wp_query = array(
                     'posts_per_page' => $offset_step_size,
                     'offset' => $nr_products_processed,
                     'post_type' => $post_type,
                     'post_status' => 'publish',
                     'fields' => 'ids',
                     'no_found_rows' => true,
               );
    $prods = new WP_Query($wp_query);
    

    You can replace the post_status line with this:

    
        'post_status' => array('publish', 'private')    
    

    That should do the trick. At least until we release a new version of the plugin and you decide to update it ??

    Have a great weekend,
    Eva

    Thread Starter svaldesm

    (@svaldesm)

    Hi Eva
    Thanks for all the help!
    What I wonder now is, which one of the options in the feed is actually the “status” (publish, private)?
    I tried “Visibility” but I got nothing.

    Thanks!

    Hi,

    Since the plugin is only retrieving published products (you changed it for your case in publish and private) there is no use for the plugin to retrieve the post_status since those will be publish always anyhow. Hence, the plugin is not retrieving the post_status.

    All the best,
    Eva

    Thread Starter svaldesm

    (@svaldesm)

    Hi Eva,

    I can see that, but what I mean is that, given that I want to pull both, I would like to separate them in those groups. Is there a way to add to the dropdown of choices the status of the product?

    Thanks

    You would have to do this (we haven’t tested this) in the code of version 7.2.7 of the plugin.

    In the class-get-products.php script remove this on line 1791, otherwise the private products won’t make it to the feed, even when you made the above WP_Query change:

    if($status != "publish") { continue; }

    Also, add the following on line 1803
    $product_data['post_status'] = get_post_status($this->parentID);

    In the class-attributes.php script you need to add the following after line 260 and the same after line 442:
    "post_status" => "Post status",

    That should do the trick.

    Best,
    Eva

    Thread Starter svaldesm

    (@svaldesm)

    Amazing Eva, thanks for the great support!!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Add private posts to feed’ is closed to new replies.