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
210 stars 137 forks source link

Products still visible in Facebook catalogue after deletion in WooCommerce #1530

Closed jbaekz closed 3 years ago

jbaekz commented 4 years ago

Hi,

One of our clients recently noticed that many of the products deleted in WooCommerce were still showing in her Facebook retargeting ads.

I did some cross checking and the products that she deletes in WooCommerce still appears in the Facebook Catalogue.

Is it build to work this way?

In my opinion it would make more sense if products deleted in WooCommerce automatically got removed from the feed/catalogue as well.

I tried doing a force sync of the products from the plugin but it doesn't remove the deleted products from the catalogue.

Let me know if you need anything.

Kind regards Jacob

lgfogle commented 4 years ago

Hey @jbaekz,

Thanks for reaching out!

What you're describing should be how Facebook for WooCommerce performs today - when a synced product is deleted in WooCommerce, it should also be removed from the Facebook catalog.

Are other updates being shared to the Facebook catalog? For example, is creating a new synced product or updating an existing synced product reflected in the Facebook catalog? I'm wondering if perhaps there is some sort of connection issue that is preventing the plugin from posting the delete for those products.

Thank you! Lindsey

jbaekz commented 4 years ago

Hi @lgfogle,

I can confirm that new products are synced correctly to the Facebook Catalogue - and product information are updated correctly. E.g. stock status.

It's strange because it is set to replace the products in the catalogue on sync - and it syncs every day. But for some reason there are old (deleted) products in the catalogue that are still showing in the catalogue.

Kind regards Jacob

jbaekz commented 4 years ago

Update: I made the choice of completely deleting the original Catalogue and setting up a new one.

Now it's stuck in importing the products to the new catalogue. :(

Everything looks to be synced when looking in the products overview and shop, but the process of importing the products looks to be stuck backend:

FB stuck 1 FB stuck 2_1

It's been 36 hours like this and I tried contacting the FB Support but haven't heard from them yet.

jbaekz commented 4 years ago

Update 2: Facebook support got back and asked me to uninstall and reinstall the plugin (...). I tried their solution, but initial sync is still stuck.

They told me that this is an issue affecting multiple users and that they're working on a solution. Just in case anyone else has this problem.

jbaekz commented 4 years ago

Hi @lgfogle,

Any updates on the feed being stuck initially issue?

Facebook Support says that they are in touch with WooCommerce (I guess they mean you guys).

The just keep asking me to re-install the plugin which obviously doesn't work.

Kind regards Jacob

lgfogle commented 4 years ago

Hey @jbaekz,

My apologies for the delay in my response, I've been out of the office. Could you please confirm if this issue is still impacting your store? Are any products synced to Facebook now? I may ask for you to contact our support team for more in depth troubleshooting if so.

Thank you! Lindsey

jbaekz commented 4 years ago

@lgfogle,

Still stuck in "Applying new feed rules" as seen in above attached picture. Even after setting up a new catalogue and setting up the integration from the start.

And still no usable answer from Facebook.

Where can I contact your support team?

Kind regards Jacob

jbaekz commented 4 years ago

Hi again @lgfogle,

My initial issue is now giving me trouble on another shop.

So when we mark a product as a draft for example, the sync status in WooCommerce shows "Sync and hide". However.. The product is not hidden from the active catalogue.

I did some troubleshooting and it seems like it is the "WooCommerce Extension" data source that is making trouble.

The products marked as drafts in WooCommerce is removed from the "WooCommerce Products" data source (the original feed). However, I can still find them in the "WooCommerce Extension" and therefore the products are still showing in the FB Catalogue.

I hope it makes sense, otherwise please reach out.

Original issue:

Hi,

One of our clients recently noticed that many of the products deleted in WooCommerce were still showing in her Facebook retargeting ads.

I did some cross checking and the products that she deletes in WooCommerce still appears in the Facebook Catalogue.

Is it build to work this way?

In my opinion it would make more sense if products deleted in WooCommerce automatically got removed from the feed/catalogue as well.

I tried doing a force sync of the products from the plugin but it doesn't remove the deleted products from the catalogue.

Let me know if you need anything.

Kind regards Jacob

simonporter007 commented 3 years ago

Hi @jbaekz,

Thanks for your feedback here! When moving a product to a draft status it will no longer be synced to the catalog by default. That said, if the product was previously synced to the catalog before it was switched to draft, it won't be updated either. This could leave the product as visible in the Facebook catalog, but hidden in your WooCommerce store.

This sounds like the situation you are describing, and is one our developers have a logged feature request for. I'm afraid I don't have an exact release date for when this might be added to the plugin. In the meantime, it should be possible to use the Facebook metabox "Delete product(s) from Facebook" link to delete the product from Facebook first, and then move it to draft status afterward. This should then not be synced back to the catalog.

Does this sound like it could work for you in the meantime?

Cheers!

mrnick88 commented 3 years ago

Hi,

Just wanted to drop in on this discussion and say that we are experiencing the same issue with our Woocommerce and FB integration.

Quite a few out of stock products and even deleted products from a couple of years ago are showing up in our fb shop catalogue, despite being deleted from Woocommerce.

I've tried deleting these products from our fb catalogue, but they seem to be re-syncing - the products in question are showing up in the catalogue but marked as sold.

As a slight work around, I've specifically grouped our current products into collections to show as the first items in our FB & Insta shop, and have also turned off the dynamic ads format within our ad campaigns, to stop out of stock or deleted products from being presented to customers. However, this is a far from ideal solution.

A plugin which is supposed to add FB functionality is actually making it more difficult to run our FB ad campaigns correctly and use all available features of the platform.

Keen to hear if there is a solution to this!

Thanks,

Nick

yeyeszozo commented 3 years ago

Hello,

I have the same problem. I'm trying to delete a category so it doesn't sync. it works for the new products of the category but it does not take into account the old ones already synchronized. In addition, it is impossible to remove them from the catalog using facebook directly.

It creates a big problem for our advertising and our business.

If anyone has a tip?

simonporter007 commented 3 years ago

Hi @mrnick88 @yeyeszozo!

Thanks for getting in touch. As this is the place for developer issues specific to the codebase, our support team on the WordPress forums would be best placed to investigate each of your cases more closely. Certainly, any deleted products should not be re-synced through our plugin as it relies on the current active products each time the sync is made. So it sounds like there's something going awry here for sure!

You can reach out to our support team at the forums here: https://wordpress.org/support/plugin/facebook-for-woocommerce/

Cheers,

jbaekz commented 3 years ago

Hi @simonporter007,

Is it somehow possible to do a forced sync of all products at a certain time e.g. at 2 am (during the night). I know this was possible in some versions of the plugin.

The problem We are using a 3. party integration to manage the stock status across a physical store and an online store.

When a product is sold in the physical store, the stock status is updated within 5 minutes. However, this update doesn't trigger the "update product" or "save changes" function on the specific product in WooCommerce and therefore the changes in stock status is not send to the Facebook Catalogue.

That means if a product is sold in the physical store and it is the last product in stock, the product stock information is not send to Facebook and therefore it is still showing "in stock" in the Facebook catalogue.

I am in contact with the 3. party stock management developers to hear if they can trigger the update product on every stock change.

So I thought a nightly forced resync would help to keep the stock information synced across the platforms. :)

Kind regards Jacob

DohertyE commented 2 years ago

When I say I deleted the feed

I deleted it from Catalog -> Data Sources

rawdreeg commented 2 years ago

@DohertyE because the initial product upload is done via Batch API, removing the data source will not delete all products.

To delete your whole catalog, the next best option is to delete the catalog, then disconnect and reconnect their Facebook for WooCommerce extension.

However, GH is not the best to receive support. For plugin support, please open a support ticket on the WordPress.org Facebook for WooCommerce forum.

If you have a WooCommerce.com account, you can start a chat or open a ticket on WooCommerce.com.

DohertyE commented 2 years ago

@jbaekz did you ever get this resolved?

I have the same issue.

I can't delete the catalog because it is linked to a Facebook shop - also no way to delete the Facebook shop

Spent 8 hours on this already.

Tried adding sv_wc_facebook_delete_all_products.php

As far as I can tell it has done nothing.

There is no option to manually delete or archive the products.

These are really old items as @rawdreeg has said were done from an initial upload.

rawdreeg commented 2 years ago

@DohertyE How many products need to be removed? sv_wc_facebook_delete_all_products.php will not work if these products are no longer in you WooCommerce store.

If deleting or creating a new catalog is not an option, the only way around this is to Edit the item from within Facebook, make a minor change to the product, then manually delete it from within Facebook: https://github.com/woocommerce/facebook-for-woocommerce/issues/2129#issuecomment-1154289129

DohertyE commented 2 years ago

Hi @rawdreeg - there are 4,000 products.

The products are no longer in the store - they are years old.

Unfortunately manually deleting it is not an option due to the number of products.

Facebook for Woocommerce gave me an edited snippet which seems to be deleting the rogue products now

rawdreeg commented 2 years ago

Great, Mind sharing the snippet?

DohertyE commented 2 years ago

Sure thing:

`<?php // only copy this line if needed

function sv_wc_facebook_delete_all_products() {

if ( ! function_exists( 'facebook_for_woocommerce' ) ) {
    return;
}

if ( get_option( 'sv_wc_facebook_delete_all_products', false ) || ! is_admin() ) {
    return;
}

/**//**/add_action('admin_footer', (function(){ echo '<p style="text-align: center">' . __( 'Reached Step A', 'textdomain' ) . '</p>'; }));

$offset         = (int) get_option( 'sv_wc_facebook_delete_all_products_offset', 0 );
$posts_per_page = 500;

do {
    /**//**/add_action('admin_footer', (function(){ echo '<p style="text-align: center">' . __( 'Reached Step 1', 'textdomain' ) . '</p>'; }));
    $products = get_posts( array(
        'post_type'      => 'product',
        'post_status'    => 'any',
        'fields'         => 'ids',
        'offset'         => $offset,
        'posts_per_page' => $posts_per_page,
        // uncomment and update the lines below to select specific taxonomy terms to update
        // 'tax_query'      => array(
        //  array(
        //      'taxonomy' => 'product_cat',
        //      'field'    => 'term_id',
        //      'terms'    => array_merge( array( 849, 850, 851 ) ),
        //  ),
        // ),
    ) );

    /**//**/add_action('admin_footer', (function(){ echo '<p style="text-align: center">' . __( 'Reached Step 2', 'textdomain' ) . '</p>'; }));

    if ( ! empty( $products ) ) {

        foreach ( $products as $product_id ) {

            $product = wc_get_product( $product_id );

            if ( $product ) {
                $retailer_ids[] = \WC_Facebookcommerce_Utils::get_fb_retailer_id( $product );
            }

            facebook_for_woocommerce()->get_products_sync_handler()->delete_products( $retailer_ids );
        }
    }

    // increment offset
    $offset += $posts_per_page;

    /**//**/add_action('admin_footer', (function(){ echo '<p style="text-align: center">' . __( "Reached Step 3: $offset", 'textdomain' ) . '</p>'; }));

    // and keep track of how far we made it in case we hit a script timeout
    update_option( 'sv_wc_facebook_delete_all_products_offset', $offset );

} while ( count( $products ) == $posts_per_page );  // while full set of results returned  (meaning there may be more results still to retrieve)

if ( count( $products ) !== $posts_per_page ) {
    update_option( 'sv_wc_facebook_delete_all_products', 1 );
}

} add_action( 'init', 'sv_wc_facebook_delete_all_products' );`

DohertyE commented 2 years ago

@rawdreeg does that script look like it should work?

I was speaking to support and while it was running (the number of items in the catalog was going down) they suggested disabling the sync. I disabled sync (in Facebook for woo-commerce plugin) and the number of items hung at 2900

I reenabled sync and now I cant get the script to run again... Is there something I can do to get that script to do a fresh run?

rawdreeg commented 2 years ago

Hum, essentially the script finds all the products in your WooCommerce store and deletes them in FB. But products not currently in your WooCommerce store FB won't be deleted by the script, from what I can see.

DohertyE commented 2 years ago

Thanks for that

This seems to be a common issue going on for a couple of years at least - Is there no know fix for it for products no longer in the Woocommerce store?

I can't set up a new shop because my page already has a shop & because according to Facebook "After you choose a catalog when setting up your shop, you can't switch it to a different one later."

🤷

rawdreeg commented 2 years ago

When connecting to your site, FB should allow you to create a new catalog for your shop. But yeah, I agree FB should give a way to reset a catalog.

DohertyE commented 2 years ago

"When connecting to your site, FB should allow you to create a new catalog for your shop."

It does, but a shop can only have 1 catalog, and this can't be changed after it has been set initially.

DohertyE commented 2 years ago

Is there something I can do to get that script to do a fresh run?

From this link:

https://woocommerce.com/document/facebook-for-woocommerce-delete-or-reset-all-facebook-products/

. If the snippet doesn’t work, however, triggering it again requires updating the option name in the code snippet or deleting the option the snippet stored in the first place.

rawdreeg commented 2 years ago

The easiest way would be to empty the sv_wc_facebook_delete_all_products option here: /wp-admin/options.php

DohertyE commented 2 years ago

Facebook support says they are going to delete the items from the catalog for me... It remains to be seen... See the email below. Hopefully, they follow through...

_Hi Evan,

We're glad to let you know that we already received an update from our specialized Team.

As per further investigation, they have confirmed that there were multiple data sources on your catalog:

For the data from WooCommerce, they recommended that removing items managed with 3rd party platforms need to be done on the platform itself and they suggested to directly contact WooCommerce for this. I have mentioned to them that you already contacted WooCommerce and for them to continue on deletion on our end, we will be needing a written approval from you giving us permission to delete the items on your behalf, following this example:

I xxxx (name and email) give the permission to delete items xxxxxxx (ID) from the existing catalog ID xxxxxxxx . The reason of my request is xxxxxx.

Name and signature xxxxxxxxx_

rawdreeg commented 2 years ago

Yes. That's probably the best way forward. Good luck !