Use cart item key instead of index in shipping items (https://github.com/woocommerce/woocommerce-blocks/pull/8199)
* use cart item key instead of index * Update src/StoreApi/Schemas/V1/CartShippingRateSchema.php Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com> Co-authored-by: Paulo Arromba <17236129+wavvves@users.noreply.github.com>
This commit is contained in:
parent
018af7c3af
commit
637c1a735f
|
@ -260,9 +260,9 @@ class CartShippingRateSchema extends AbstractSchema {
|
|||
*/
|
||||
protected function prepare_package_items_response( $package ) {
|
||||
$items = array();
|
||||
foreach ( $package['contents'] as $item_id => $values ) {
|
||||
foreach ( $package['contents'] as $values ) {
|
||||
$items[] = [
|
||||
'key' => $item_id,
|
||||
'key' => $values['key'],
|
||||
'name' => $values['data']->get_name(),
|
||||
'quantity' => $values['quantity'],
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue