Support » Plugin: WooCommerce » Assigning email address to each line item in order

  • Resolved Thomas S



    I have a membership site where I’m trying to assign different email addresses as the item meta for each item added to the cart.

    I’m using a combination of the following actions/filters along the lines of what’s described here:


    Assigning the email address/user info works great as long as I don’t attempt to add a 2nd product (i.e. increment the quantity by selecting the same product twice).

    To (try to) allow having one line item per item of the same product, I use woocommerce_add_to_cart and the linked code.

    This code splits out the individual product line items (same product). However, it seems – to me – like the ‘woocommerce_get_cart_item_from_session’ filter may be overwriting the content of the _e20r_item_owner key whenever it’s called against the same product ID.

    I’ve tried using a base64 hash of the email address and used a different email address each time I add the same product ID to the cart. The result is that the most recently used email hash is the one being shown in the resulting $data array output from the woocommerce_get_item_data filter.

    This is true for all of the line items representing an added instance of the product with ID # 1407 in the cart.

    How can I assign and persist a different item meta data value every time the same product id is added to the cart (and not have it appear to overwrite the previously added items with the same ID)?

Viewing 1 replies (of 1 total)
  • Thomas S


    Figured it out: Had a shopping wizard plugin for WooCommerce that was “misbehaving” (it cleared the cart and re-added everything the product count was incremented).

Viewing 1 replies (of 1 total)
  • The topic ‘Assigning email address to each line item in order’ is closed to new replies.