Yoast / wordpress-seo

Yoast SEO for WordPress
https://yoast.com/wordpress/plugins/seo/
Other
1.78k stars 894 forks source link

[Feature Request] Remove WooCommerce Products from Product AND Product Category sitemap when they have the status of "Out of Stock" #6249

Open Pcosta88 opened 7 years ago

Pcosta88 commented 7 years ago

If a user has a product it appears on the sitemap. If that product then sells it will remain on the sitemap until removed manually by the user. To manually remove it, the user will need to mark the page as noindex.

We should include an automatic removal from the sitemap. For example, when a user manually changes the product status to "out of stock" the product is then automatically removed from the sitemap.

screen_shot_2017-01-24_at_1_56_47_pm

Pcosta88 commented 7 years ago

Please inform the customer of conversation # 164385 when this conversation has been closed.

SingingBowls commented 7 years ago

As the default setting, excluding "out of stock" is probably best for most stores.

In store management there are two kinds of "out of stocks", temporary and permanent. Woocommerce does not provide a way to distinguish between them.

√ "enable stock management" in the inventory section of product files automatically sets products with stock quantity =0 to "out of stock" as they sell. This works fine for products that sell out and never come back. Stores selling unique or quantity limited stock use this as do stores who do not want to disapoint customers with unavailable items.

Stores wishing to continue to keep products with zero inventory on their sitemap because they are only temporarily unavailable could un√ "enable stock management". Some stores do this. Others do not because unavailable products will appear on their website.

So you might want to make this an option on the post types tab for those stores wanting to continue to list items they don't currently have.

Even if you don't make it an option many stores will benefit by having the products sitemap smart enough to exclude out of stocks.

Pcosta88 commented 7 years ago

Please inform the customer of conversation # 172985 when this conversation has been closed.

SingingBowls commented 7 years ago

Does this mean remove from sitemap when status changes to out of stock is now on your programming agenda? When do you expect it to be implemented?

Pcosta88 commented 7 years ago

@SingingBowls At this moment it is just a request for our developers to consider.

mugwumpr commented 7 years ago

This would totally rock for our used bookstore. We have 169K+ items with only about 33K active at any given time. We never know when we'll need to reactivate a product, depending on what comes in, so removing the records completely isn't an option. Needless to say, we get a lot of 404 errors and Google currently hates us.

If you're counting votes in favour, please include mine.

Djennez commented 5 years ago

@jono-alderson you seem to have had a very thoroughly explained opinion on a related matter in #6502 . Would you mind having a look at this request? What, do you think, would be the pro's and con's in this?

SingingBowls commented 5 years ago

Hi Jannes,

What I read was not relevant. In stock / out of stock is not my issue

When a unique product sells I delete it. All my deleted products remain in my sitemap. Thousands of them. It is a mess and maybe Google toxic.

Solutions Best – when a product is deleted it is removed from the sitemap OK – a way for the product sitemap to be deleted and regenerated freshly from the existing database. Terrible – hunt and peck somewhere.

jonoalderson commented 5 years ago

Ooh, interesting stuff!

Two threads here, so picking them apart...

On the 'two types' of 'out of stock' behaviour

This is indeed challenging. I'd really love for a 'permanent' out of stock status to be handled differently (noindex, remove from sitemaps, etc) to a 'temporary' out of stock. We'll have a think about how this might be handled; it might be a space for an additional WooCommerce addon/plugin/setting.

On product deletion / XML sitemaps

I'm not sure how/why a deleted product would still remain in the sitemap - if it's been deleted, there's no page/URL to show. It sounds like perhaps your deletion process isn't actually deleting the products/pages, or, we have an issue with how your sitemaps are being generated.

mugwumpr commented 5 years ago

In the first "permanent out of stock", something as simple as a checkbox option to "remove from sitemap" would be sufficient in most cases, with an added option to make that the global default behaviour. Then we could turn it on and off as required, in the Used Bookstore example.

On Mon, 28 Jan 2019 at 01:59, Jono Alderson notifications@github.com wrote:

Ooh, interesting stuff!

Two threads here, so picking them apart... On the 'two types' of 'out of stock' behaviour

@SingingBowls https://github.com/SingingBowls This is indeed challenging. I'd really love for a 'permanent' out of stock status to be handled differently (noindex, remove from sitemaps, etc) to a 'temporary' out of stock. We'll have a think about how this might be handled; it might be a space for an additional WooCommerce addon/plugin/setting. On product deletion / XML sitemaps

I'm not sure how/why a deleted product would still remain in the sitemap - if it's been deleted, there's no page/URL to show. It sounds like perhaps your deletion process isn't actually deleting the products/pages, or, we have an issue with how your sitemaps are being generated.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Yoast/wordpress-seo/issues/6249#issuecomment-458045684, or mute the thread https://github.com/notifications/unsubscribe-auth/AWVEccuXnWkNIWI73LBO9xtEtGIjpzZ0ks5vHrwDgaJpZM4LK-YD .

-- Linda McClure Website Minion http://websiteminion.ca

SingingBowls commented 5 years ago

Your status name might be “unique item” or “discontinue upon last sale” which triggers the sitemap removal etc upon last sale. Only issue there is (in my store, anyway) occasionally a customer returns a unique item so I need to light up the SKU again.

It is entirely possible that woo commerce delete does not delete products from the database. The URL is gone is what I can see. As someone who is mostly on the extensable level the database is a black box to me.

I delete sold items to limit the size of my data in an effort to improve site performance.

Thanks, Ryan

jonoalderson commented 5 years ago

Thanks for the feedback. We'll have a look at this, and consider options and ideas!

Pcosta88 commented 5 years ago

Please inform the customer of conversation # 483986 when this conversation has been closed.

SingingBowls commented 5 years ago

Does closed mean it is on the list for development or dropped from consideration?

Pcosta88 commented 5 years ago

@SingingBowls Hi, We mean that when we have a resolution for the issue we will contact the customer who has ticket number 483986.

SingingBowls commented 5 years ago

OK, I am asking - what was the resolution?

Pcosta88 commented 5 years ago

@SingingBowls The issue is still an open one. No resolution or decision has been made on it.

mayada-ibrahim commented 5 years ago

Please inform the customer of conversation # 558765 when this conversation has been closed.

Pcosta88 commented 4 years ago

Please inform the customer of conversation # 633989 when this conversation has been closed.

suascat commented 3 years ago

Please inform the customer of conversation # 775158 when this conversation has been closed.

ogodoabiola commented 2 years ago

Please inform the customer of conversation # 845391 when this conversation has been closed.

monbauza commented 2 years ago

On my test site, I've been able to exclude out-of-stock products from the sitemap using the filter below:

add_filter( 'wpseo_sitemap_entry', 'custom_exclude_from_xml_sitemap', 10, 3 );
function custom_exclude_from_xml_sitemap( $url, $type, $object ) {
    if ($object->post_type == 'product') {
        $product = wc_get_product( $object );
        if (!$product->is_in_stock())
            return false;
    }
return $url;
}
suascat commented 2 years ago

Please inform the customer of conversation # 873216 when this conversation has been closed.

maybellyne commented 2 years ago

Please inform the customer of conversation # 879051 when this conversation has been closed.

Yvonne-Palanca commented 1 year ago

Please inform customer #989361 when this conversation has been closed.

Stason077 commented 1 year ago

On my test site, I've been able to exclude out-of-stock products from the sitemap using the filter below:

add_filter( 'wpseo_sitemap_entry', 'custom_exclude_from_xml_sitemap', 10, 3 );
function custom_exclude_from_xml_sitemap( $url, $type, $object ) {
  if ($object->post_type == 'product') {
      $product = wc_get_product( $object );
      if (!$product->is_in_stock())
          return false;
  }
return $url;
}

Thank you. Your code worked! Perhaps you have similar code, for conversion an "noindex" for "out of stock" products?

maybellyne commented 3 months ago

Please inform the customer of conversation # 1161409 when this conversation has been closed.