SalesforceCommerceCloud / pwa-kit

React-based JavaScript frontend framework to create a progressive web app (PWA) storefront for Salesforce B2C Commerce.
https://developer.salesforce.com/docs/commerce/pwa-kit-managed-runtime/guide/pwa-kit-overview.html
BSD 3-Clause "New" or "Revised" License
276 stars 124 forks source link

[BUG] Enabled attribute not working for the registerCustomer (Shopper Customers) endpoint #1868

Closed GerFres closed 1 week ago

GerFres commented 1 week ago

Summary

For the registerCustomer endpoint of the B2C Commerce API, even though it specifies that you can use the enabled property for the customer to mark the customer as enabled or not enabled, it doesn't seem to be working at all.

Not sure if this is an issue with the commerce-sdk that may be excluding this property from being sent to the API

Steps To Reproduce

  1. Include the enabled attribute in the registration payload Captura de pantalla 2024-06-26 a las 19 08 04

  2. Register a customer through the normal registration flow in the storefront

  3. The customer is enabled even thought we specified false in the enabled property

Expected result

Customer to be registered but disabled

Actual result

Registered customer and enabled

System Information (as applicable)

Browser: Node version: pwa-kit version: Desktop OS: Mobile Device Info:

Additional information

Feel free to attach a screenshot.

johnboxall commented 1 week ago

@GerFres the enabled property of the underlying API is readonly:

https://developer.salesforce.com/docs/commerce/commerce-api/references/shopper-customers?meta=registerCustomer

If you'd like to set enabled to a different value, use Hooks:

https://developer.salesforce.com/docs/commerce/commerce-api/guide/extensibility_via_hooks.html

In particular the dw.ocapi.shop.customer.afterPOST hook should do what you want!