• Problem:
    After moving a product to trash with an assigned generator, the generator still shows the now-trashed product at the top of the edit page. Example: https://i.imgur.com/CCPGiSd.png.

    Steps to repro:
    Create a variable product, with an assigned generator for each variation: https://i.imgur.com/SyXNibt.png. After publishing the product, and verifying that it is listed on the “Edit” page for that generator, move the product to trash, and refresh the generator “Edit” page. I would expect the same behavior from a Simple Product with an assigned generator, but have only tested it using a Variable Product.

    Possible solutions:
    Verify that the proper action is being hooked for trashing products. AFAIK moving a woocommerce product to trash is handled the same as if it were a post, so most likely hooking wp_trash_post would suffice. I haven’t inspected the source, but it’s possible the plugin may be using wp_delete_post hook (if any at all), which does not run when moving a post to trash (only when permanently deleting the post).

    Another (possibly better) method would be to simply check the product post’s status when querying the linked products for the generator’s edit page, and filtering which ones are displayed (or how they are displayed) based on the post status (example: https://i.imgur.com/MdA1MEx.png):

    
    if ('trash' == get_post_status( $post_id )) {
      // skip this one, or suffix the product name with "(in trash)", etc
    }
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Stelio Kontos

    (@steliokontos)

    Additionally, the links for the associated products link to that generator’s edit page (the same page they’re being viewed from – https://i.imgur.com/DOTRVu1.png). It would seem more appropriate to have them link to the actual product edit page instead.

    Current: {site_url}/wp-admin/admin.php?page=lmfwc_generators&action=edit&id={generator_id}&_wpnonce={nonce}
    Suggested: {site_url}/wp-admin/post.php?post={post_id}&action=edit

    @steliokontos Hi,

    Let me look into it, if there will be any issues we will fix them in our next release.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Bug Report: Trashed product w/assigned generator’ is closed to new replies.