Returns the cart contents without the cart item key as the parent array.
<?php | |
/** | |
* Returns the cart contents without the cart item key as the parent array. | |
* | |
* @param array $cart_contents | |
* @return array $cart_contents | |
*/ | |
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 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment