woocommerce / facebook-for-woocommerce

A first-party extension plugin built for WooCommerce. Development is managed by Ventures.
https://woocommerce.com/products/facebook/
GNU General Public License v2.0
211 stars 140 forks source link

Quantity to sell not syncing #2720

Open jonkinesis opened 7 months ago

jonkinesis commented 7 months ago

It seems that the quantity to sell (stock) is not syncing from the plugin to the shop.

πŸ”Ž Isolate the bug

✍️ Describe the bug

πŸšΆβ€β™€οΈ Steps to reproduce

  1. The first step
  2. The next step…

βœ”οΈ Expected behavior

πŸ—ƒ Logs

s-m-martin commented 7 months ago

Any updates on this? I have a very unhappy customer right now for my web design business because the items on the synced Facebook store all show out of stock :(

theabhig commented 5 months ago

Also seems to be the case in 8321973-zen

nicdwilson commented 4 months ago

8392230-zd-a8c

1dr0 commented 4 months ago

8418948-zen 8394619-zen

1dr0 commented 4 months ago

I wonder if they are affected by this: https://wordpress.org/support/topic/incompatibility-with-checkout-on-facebook-instagram-us-only/

theabhig commented 4 months ago

8447003-zen

lynnjat7 commented 4 months ago

If you are facing this issue, please check your checkout method in Commerce Manager. Here's how you can do that: https://www.facebook.com/business/help/242644617460119

For countries outside of the US, this option should be set to "checkout on another website" when working with the Facebook for WooCommerce plugin. This will redirect shoppers on Facebook to your own website for purchase and checkout.

In the United States, checkout on other websites is no longer supported as of April 2024.

If you are building a storefront on the Facebook side, you likely have this setting set to "checkout on Facebook and Instagram."

In this case, please note that WooCommerce will push product information onto Facebook for use in building the shop, but does not send across inventory numbers. This is because Facebook cannot send notice of sales back to your website, so inventory numbers quickly become out of sync. WooCommerce will continue to push information to Facebook which may override information on Facebook sales, and products on your site will not be updated with any Facebook sales.

For this reason, WooCommerce only pushes information regarding "available / unavailable" for products, not the actual inventory numbers.

If products are marked in WooCommerce to "manage stock" and have a stock value that is above zero, they will be marked as "available" when sending the information to Facebook. However, we have seen that Facebook does interpret this as "available - inventory zero" which can be marked as "out of stock" on their side. We are working with them to resolve this bug in Meta. Products that do not use stock management on the WooCommerce side should likewise be pushed to Facebook as "available" but this may be misinterpreted on the Facebook side.

In general, we are only recommending using the Facebook for WooCommerce plugin in the United States as a catalog feed for creating ads, and not as the source of data for your live shop at this time. However, if you would like to try it, other WooCommerce users have offered this snippet as a potential workaround.

Please note that this snippet is not created by WooCommerce and would not be supported by their customer support channels. To use this snippet, you could use a free plugin like Code Snippets to drop this code into your site without altering your theme.

 function facebook_sync_issue( $product_data, $id ) {       
        $product = wc_get_product($id);

    $stock_value =  $product->is_in_stock() ? 100 : 0;

    if ( $product->managing_stock() ) {
        $stock_value = (int) max( 0, $product->get_stock_quantity() );
     }

    $product_data['quantity_to_sell_on_facebook'] = $stock_value; 
    return $product_data;
}
add_filter( 'facebook_for_woocommerce_integration_prepare_product', 'facebook_sync_issue', 10, 2 );

Note that this snippet will push initial inventory numbers across and will use a default value of "100" for any products that are not actively managing inventory. But these numbers will not be cross-updated between Facebook and your shop, so by allowing sales in both places, managing actual inventory numbers is going to become a manual challenge.

chrism245 commented 3 months ago

8555048-zen

1dr0 commented 2 weeks ago

8997297-zen 8998328-zen 8998416-zen 9009634-zen