Home Forums WoodMart support forum “Back in Stock” email template repeating products from WishList of other users

“Back in Stock” email template repeating products from WishList of other users

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #556080

    climb512
    Participant

    Hello,

    I have the Back in Stock email enabled, which sends an email to all customers who have an item on their Wishlist once the item returns to stock. The email lists the Wishlist items of each particular customer.

    The problem I see is that whenever a batch of emails is sent, each successive email lists ALL the products — even of the previous customers — to the next customer on the list. For example:

    Customer A has Item #1 on their Wishlist

    Customer B has Item #2 on their Wishlist

    Customer A has Item #1 and Item #2 on their Wishlist

    If both Item #1 and Item #2 come back into stock, the customers receive emails as follows:

    Customer A sees:
    Item #1 (this is correct)

    Customer B sees:
    Item #1 (Incorrect)
    Item #2 (Correct)

    Customer C sees:
    Item #1 (Correct)
    Item #2 (Correct)
    Item #1 (Repeated)
    Item #2 (Repeated)

    This continues — some of my customers with a single item in their Wishlist will get an email listing dozens of items.

    Please see the attached image, showing 3 recent emails to 3 different users.

    To me, it appears that the product list in /wp-content/themes/woodmart/woocommerce/emails/back-in-stock.php is not being reset between email sends.

    Thanks for looking into this.

    Attachments:
    You must be logged in to view attached files.
    #556202

    Hung Pham
    Keymaster

    Hi climb512,

    Thanks for reaching to us.

    To better assist you, could you kindly test the functionality with default WordPress themes such as TwentyTwenty or WooCommerce Storefront? This will help us determine whether the issue stems from our theme or elsewhere.

    Regards,

    #556245

    climb512
    Participant

    Hello,

    I have tried installing various themes as suggested (Storefront, Twenty Twenty, and Twenty Twenty-Four) but none of them have the Wishlist feature. To confirm the Wishlist I am using is a Woodmart specific feature I have disabled all but the essential plugins:

    Active plugins:
    Woodmart Core
    Woocommerce
    Elementor
    UpdraftPlus – Backup/Restore
    WP Mail Logging (to check on which Wishlist emails have been sent)

    I tried the entire process again with two test users, as follows:
    — use one user to add an out-of-stock item to their Wishlist
    — use a second user to add a different out-of-stock item to their Wishlist
    — confirm that these two users do not have the same items on their Wishlists
    — set both items to be in-stock
    — wait for the cron-job to run and send the emails
    — confirm that the first user to get an email gets the proper email
    — see that the second user to get an email ALSO gets the item that was in the first users Wishlist, as well as his own item.

    Thank you for your attention to this. I am coming back into stock on hundreds of items in the next week or so and I anticipate a big mess if my customers get the sorts of emails I am seeing.
    Thanks

    #556294

    climb512
    Participant

    Hi,

    I looked at the php code and I believe I found the fix. I am unsetting the $this->items variable after each email is sent.

    …/themes/woodmart/inc/integrations/woocommerce/modules/wishlist/emails/class-back-in-stock-email.php
    I added one line after the $this->send(…) call on line 94:

    $this->send($this->get_recipient(), $this->get_subject(), $this->get_content(), $this->get_headers(), $this->get_attachments());

    /** ——- Added: Ted R 2024-04-10 ——–
    * Fix bug where emails including wishlist items of prior users are sent to subsequent users
    */
    unset($this->items);

    Please have your developers take a look and confirm that this is acceptable.

    Also, since I altered the code in the main theme directory, it will be overwritten on update. Should I add my change to my child-theme at
    /themes/woodmart-child/inc/integrations/woocommerce/modules/wishlist/emails/class-back-in-stock-email.php,
    or wait for an official update to the main theme on your end?

    Thanks, Ted

    #556497

    Hung Pham
    Keymaster

    Hi climb512,

    Glad to hear your issue has been resolved.

    It’s not guarantee that copy file from Parent into child theme will works, you can try it.

    Also, you can create a ticket here: https://woodmart.canny.io/feature-requests so our developers will consider such a feature.

    Regards,

    #556550

    climb512
    Participant

    I tried copying my altered version of the file
    class-back-in-stock-email.php
    to
    /themes/woodmart-child/inc/integrations/woocommerce/modules/wishlist/emails/class-back-in-stock-email.php
    but the issue returned (meaning my altered file in the child-theme was not used, and the original file in the main woodmart theme was used).

    I will add this info to the feature-request page that you suggest, but a bug-report page would be more appropriate, as this is definitely not working as you expect it to. I would appreciate it if you could show this thread to a php developer, as they will immediately see that this is a real issue.

    Just so you understand, this is not a “feature”, the issue is an actual bug in your code, which I believe is affecting everyone who is using the Wishlist “back-in-stock” emails.

    I am attaching my altered php class so your developers can clearly see the change needed.

    Thanks, Ted

    #556552

    climb512
    Participant

    I could not attach my file:

    Upload Errors:
    class-back-in-stock-email.php: Sorry, you are not allowed to upload this file type.

    Please let me know if you wish to see it.
    Thanks, Ted

    #556560

    climb512
    Participant
    #556697

    Hung Pham
    Keymaster

    Hi climb512,

    You can upload to https://wetransfer.com/ and share link here.

    Keep us in mind for future questions and concerns, we’re always here to help!

    Regards,

    #556764

    climb512
    Participant

    WeTransfer link added to the “Extra Info” section. I also included xtemos@gmail.com in the link (the only Support email I could find).

    #556951

    Hung Pham
    Keymaster

    Hi climb512,

    Thank you. Keep us in mind for future questions and concerns, we’re always here to help!

    Regards,

Viewing 11 posts - 1 through 11 (of 11 total)