Skip to content

Instantly share code, notes, and snippets.

@andrewwheal
Last active December 21, 2015 04:19
Show Gist options
  • Save andrewwheal/6248565 to your computer and use it in GitHub Desktop.
Save andrewwheal/6248565 to your computer and use it in GitHub Desktop.
$existing_item = $this->get_item_by_id($new_item->get_product_id());
if ($existing_item && $existing_item->bundle_variants && $new_item->bundle_variants) {
$fuck_you_1 = array_keys($existing_item->bundle_variants);
$fuck_you_2 = array_keys($new_item->bundle_variants);
sort($fuck_you_1); sort($fuck_you_2);
if ($fuck_you_1 != $fuck_you_2) {
$existing_item = null;
}
}
if ($existing_item) {
$qty = $existing_item->qty + $new_item->qty;
$existing_item->set_qty($qty);
return $existing_item;
} else {
$this->quote()->items[] = $new_item;
return $new_item;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment