
Description
This issue is automatically created based on existing pull request: #28222: [Wishlist] Giving the possibility to set/update item description on item update
Preconditions (*)
This PR improves the wishlist item update, by allowing to update the description while updating the wishlist item.
The problem occurs, when we want to set/update the item description in the same time when we update item's quantity, which doesn't seem to be supported for now.
Related Pull Requests
Fixed Issues (if relevant)
N/A
Steps to reproduce:
- Create a simple product;
- Log in on the storefront
- Add the simple product to wishlist
- Now, programmatically, try to update the quantity and the description for this item.
$wishlistId = 1;
$wishlistItemId = 1;
/** @var \Magento\Wishlist\Model\Wishlist $wishlist */
$wishlist = $objectManager->create(\Magento\Wishlist\Model\Wishlist::class);
$wishlistItemFactory = $objectManager->create(\Magento\Wishlist\Model\ItemFactory::class);
$wishlistItemResource = $objectManager->create(\Magento\Wishlist\Model\ResourceModel\Item::class);
$wishlist->load($wishlistId);
/** @var WishlistItem $wishlistItem */
$wishlistItem = $wishlistItemFactory->create();
$wishlistItemResource->load($wishlistItem, $wishlistItemId);
$wishlistItem->setDescription('My new description');
$wishlist->updateItem($wishlistItem, new \Magento\Framework\DataObject(['qty' => 777]));
Actual Result: ✖️ Quantity updated, but no description
Expected Result: ✔️ Quantity and description updated
Questions or comments
Looks like the description, is only used in case there is a new wishlist item created, which only happens if we're trying to update the item with some different options(custom options/super_attribute, etc) that are already added to wishlist.
Contribution checklist (*)
- Pull request has a meaningful description of its purpose
- All commits are accompanied by meaningful commit messages
- All new or changed code is covered with unit/integration tests (if applicable)
- All automated tests passed successfully (all builds are green)