Allow to use setShippingProfile method to remove the profile

Created on 13 September 2023, over 1 year ago

Problem/Motivation

Wishlist API allows to set the Shipping Profile related to the wishlist. However, it is not possible to unset the value, given that method only allows to pass ProfileInterface objects as parameters.

Steps to reproduce

Create a Wishlist and a Profile
Set the profile $wishlist->setShippingProfile($profile)->save()
Try to unset the profile $wishlist->setShippingProfile(NULL)->save()
Exceptions thrown: TypeError: Drupal\commerce_wishlist\Entity\Wishlist::setShippingProfile(): Argument #1 ($profile) must be of type Drupal\profile\Entity\ProfileInterface

Proposed resolution

Allow to pass NULL as parameter to unset the profile.

Feature request
Status

Needs review

Version

3.0

Component

Code

Created by

🇪🇸Spain plopesc Valladolid

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024