Skip to content

Commit 8ca3c87

Browse files
authored
Merge pull request AdobeDocs#323 from oshmyheliuk/CEXT-4251
CEXT-4251: Update examples with customer data and product attributes
2 parents 5225562 + e3e3ad7 commit 8ca3c87

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

src/pages/starter-kit/checkout/use-cases.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,84 @@ The following example demonstrates how to add a webhook to the `plugin.magento.o
170170

171171
You can register multiple webhooks for different shipping methods or shipping carriers by adding them into the same batch to ensure they are executed in parallel or create multiple batches to execute them sequentially.
172172

173+
## Shipping methods: Payload
174+
175+
The request payload contains information about all items in the cart, including product information, product attributes, shipping address, and customer information for logged-in customers.
176+
177+
Payload example:
178+
179+
```json
180+
{
181+
"rateRequest": {
182+
"all_items": [
183+
{
184+
"item_id": "1",
185+
"quote_id": "1",
186+
"created_at": "2025-02-18 14:57:03",
187+
"updated_at": "2025-02-24 03:44:49",
188+
"product_id": "9",
189+
"store_id": 1,
190+
"parent_item_id": null,
191+
"is_virtual": "0",
192+
"sku": "simple-product-1",
193+
"name": "Simple product 1",
194+
"price": 500,
195+
"base_price": 500,
196+
...
197+
"product": {
198+
"entity_id": "9",
199+
"attribute_set_id": "4",
200+
"type_id": "simple",
201+
"sku": "simple-product-1",
202+
"price": "500.000000",
203+
...
204+
"attributes": {
205+
"manufacturer": "Demo Company",
206+
"color": "Red",
207+
"country_origin": "Japan",
208+
...
209+
}
210+
}
211+
}
212+
],
213+
"dest_country_id": "US",
214+
"dest_region_id": 12,
215+
"dest_region_code": "CA",
216+
"dest_street": "3320 N Crescent Dr\nBeverly Hills",
217+
"dest_city": "Los Angeles",
218+
"dest_postcode": "70210",
219+
"package_value": 1100,
220+
"package_value_with_discount": 1100,
221+
"package_weight": 124,
222+
"package_qty": 2,
223+
"package_physical_value": 1100,
224+
"free_method_weight": 124,
225+
"store_id": 1,
226+
"website_id": "1",
227+
"free_shipping": 0,
228+
"base_currency": {
229+
"currency_code": "USD"
230+
},
231+
"package_currency": {
232+
"currency_code": "USD"
233+
},
234+
...
235+
"customer": {
236+
"entity_id": "1",
237+
"website_id": "1",
238+
"email": "test@example.com",
239+
"group_id": "1",
240+
"firstname": "John",
241+
"middlename": null,
242+
"lastname": "Doe",
243+
...
244+
}
245+
}
246+
}
247+
```
248+
249+
You can find examples of how to use shipping addresses, customer data, and product attributes in your App Builder application in [`actions/shipping-methods.js`](https://github.com/adobe/commerce-checkout-starter-kit/blob/main/actions/shipping-methods/index.js).
250+
173251
## Shipping methods: GraphQL
174252

175253
In the `setShippingAddressesOnCart` mutation, available shipping methods that are returned by the webhook are appended to the `available_shipping_methods` field.

0 commit comments

Comments
 (0)