WordPress.org

Forums

WooCommerce - excelling eCommerce
Treat cart items individually without using grouped products (1 post)

  1. Nancy
    Member
    Posted 1 year ago #

    I am working on a site that allows a person to personalize each item they add to the cart (custom embroidery). It is possible that a person will add the same sku to the cart but have different personalization for each item. Initially when the same sku is added the cart total reflects this, however, when you go to checkout it simply replaces the first item that was added to the cart with the most recent one.

    How can I get each item be displayed separately?

    I came across this thread and was hoping that it would solve my problem:
    http://wordpress.org/support/topic/how-to-treat-cart-items-individually-rather-than-grouped-product

    Unfortunately after adding the suggested code below I still cannot add cart items with the same sku individually.

    add_filter('woocommerce_add_cart_item_data','namespace_force_individual_cart_items',10,2);
    function namespace_force_individual_cart_items($cart_item_data, $product_id)
    {
    	$unique_cart_item_key = md5(microtime().rand()."Hi Mom!");
    	$cart_item_data['unique_key'] = $unique_cart_item_key;
    
    	return $cart_item_data;
    }

    Any help would be greatly appreciated!

    https://wordpress.org/plugins/woocommerce/

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic