Shopify / ui-extensions

MIT License
248 stars 35 forks source link

[Checkout UI] Add `removeAttribute` interface #650

Open gil-- opened 1 year ago

gil-- commented 1 year ago

Please list the related package(s)

checkout-ui-extensions

If this related to specific APIs or components, please list them here

Is your feature request related to a problem? Please describe.

Unless I'm overlooking something, we can't remove cart attributes currently. Only updateAttribute is exposed which means even using an empty string keeps the attribute and we can't set null since string is expected.

Describe the changes you are looking for

Add removeAttribute interface which has a payload like:

{
  /**
   * The type of the `AttributeRemoveChange` API.
   */
  type: 'removeAttribute';

  /**
   * Key of the attribute to add or update
   */
  key: string;
}

Similar to the removeMetafield or removeNote change apis.

Describe alternatives you’ve considered

Tried setting to null or empty string but cart attribute remains.

Additional context

See https://github.com/Shopify/ui-extensions/blob/main/packages/checkout-ui-extensions/src/extension-points/api/standard/index.ts#L167

yuzushioh commented 1 year ago

+1 for this 👍🏻

IntegralParts commented 1 year ago

This is a necessary feature since the alternative is empty attributes in the order, which is not great. +1

cargix1 commented 8 months ago

+1

patryk-smc commented 8 months ago

According to the latest AMA, adding this API is not planned

https://discord.com/channels/842813079926603828/1159538499070984243

awd commented 8 months ago

+1

julien-mamalian commented 7 months ago

+1, empty attributes can cause issue for some merchants

Job-madi commented 3 months ago

+1

antonbelinskiy commented 1 month ago

+1

w-schwier commented 2 weeks ago

+1