This is a Developer level doc. We are unable to provide support for customizations under ourĀ Support Policy. See guide on adding PHP code without editing files.
API Version: 1
<?php /** * Returns the cart contents without the cart item key as the parent array. * * @param array $cart_contents Before cart contents changed. * @return array $cart_contents After cart contents changed. */ function remove_parent_cart_item_key( $cart_contents ) { $new_cart_contents = array(); foreach ( $cart_contents as $item_key => $cart_item ) { $new_cart_contents[] = $cart_item; } return $new_cart_contents; } add_filter( 'cocart_return_cart_contents', 'remove_parent_cart_item_key', 0 );
Was this helpful to you?
Did you like the article/guide or would you like to give some feedback? Click on one of the buttons and let us know your opinion!