Skip to content

Instantly share code, notes, and snippets.

@rayflores
Created November 17, 2016 16:41
Show Gist options
  • Save rayflores/8911f685fdaf5419208cfd67b3dcbcba to your computer and use it in GitHub Desktop.
Save rayflores/8911f685fdaf5419208cfd67b3dcbcba to your computer and use it in GitHub Desktop.
<?php
$i=1;
foreach (WC()->cart->cart_contents as $item) {
if ( isset( $cart_item[ 'composite_data' ] ) && ! empty( $cart_item[ 'composite_parent' ] ) ) {
return $cart_item_class . ' item-' . $i + 10;
} elseif ( isset( $cart_item[ 'composite_data' ] ) && ! empty( $cart_item[ 'composite_children' ] ) ) {
return $cart_item_class . ' item-' . $i + 20;
} else {
return $cart_item_class . ' item-' . 200 + $i;
}
$i++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment