Facebook-for-woocommerce: Out of stock products hidden but still published

Created on 30 Oct 2017  路  7Comments  路  Source: facebookincubator/facebook-for-woocommerce

Hidden products are no longer published to Facebook, but when setting "Out of stock visibility" in WooCommerce, Products, Inventory to "Hide out of stock items from the catalog", those items are still published.

image

feature-request planned

Most helpful comment

Yes please. Selling unique items, so they go "out of stock" when one sells.... In this case, they don't come back into stock.

All 7 comments

Hello,

Thanks for flagging this!
You could try the workaround in #37 to deal with this temporarily. (#20 also mentions this request)

Not syncing Out of stock is a bit tricky to solve for this plugin. We could look at the setting in your screenshot and not sync out of stock products in the initial sync, that would be an easy fix, however there's a problem : we'll have an issue if some product becomes in-stock all of a sudden, we'll need to create it and sync it.

I'm not aware of any hooks we can use to solve that problem which is why it's challenging for us to build this feature.

Some more info about how FB treats out of stock:

  • Out of stock products will sync with FB but will not show up in dynamic ads.
  • Out of stock products will show up in the shop, but are marked out of stock.

I'm thinking we could provide an advanced option, 'only sync products that are in stock' for users that want this feature. But it will still suffer from the problem mentioned above, if products can go from out of stock to in stock then we'll need a more advanced solution.

Yes please. Selling unique items, so they go "out of stock" when one sells.... In this case, they don't come back into stock.

Hi @jwit and @perrochon ,

If you try 'sync products' to force resync, to click update on the product editor , will you see the products (the ones out of stock on your db) updated as 'out of stock' status on facebook shop? We check it here.

For the out-of-stock products, Facebook page will be grey out and displayed 'out of stock' which could be the same as invisible. But we dont support the automatic stock tracking now, reasons as @dmitridr explained.
screen shot 2018-06-26 at 3 04 32 pm

If any of you are interested in supporting this, feel free to send us a pull request. We will prioritize to review your commit!

Thanks.

I think you can fix it by adding this code in your function.php file. It will still sync the out of stock product to your FB but it will mark it as not published.

/**
 * -----------------------------------------------------------------------------
 *
 * Woo Product to Facebook filter
 * 
 * @since 3.5.2
 * @param int $id Product ID
 * @param array $product_data Product data array
 *
 * -----------------------------------------------------------------------------
 */
function wc_facebook_product_item_filter($product_data, $id) {

        // don't publish out of stock item
        if('out of stock' === $product_data['availability']):
                $product_data['visibility'] = 'staging';
        endif;

        // return data
        return $product_data;
}

add_filter('facebook_for_woocommerce_integration_prepare_product', 'wc_facebook_product_item_filter', 10, 2);

Hey all,

We have a planned fix for this issue that will ensure out-of-stock products are set to staging when they are configured to sync to Facebook. We will update this issue once a fix is released!

Thank you,
Lindsey

_Internal reference CH55890_

Thanks for your patience all, this should now be the case in the latest release! If you have any further issues with this in the current plugin, please don't hesitate to let us know.

Cheers,

Simon.

Was this page helpful?
0 / 5 - 0 ratings