Looking to set a cross domain cookie for two domains on the same server with wordpress multisite in a guest session
<p>I currently have a Wordpress Multisite set up with WooCommerce. My goal is to have a shared shopping cart in a GUEST session for a subbblog mapped domain, and full domain itself. </p>

<p>ie the shopping cart would be the same for:</p>

<ul>
<li><p><a href="http://www.blog2mappeddomain.com/cart/" rel="nofollow">http://www.blog2mappeddomain.com/cart/</a></p>

<p>and</p></li>
<li><p><a href="https://networkdomain.com/blog2/cart/" rel="nofollow">https://networkdomain.com/blog2/cart/</a></p></li>
</ul>

<p>While I can get the carts working independently, they will have their own cookies on each respective domain.</p>

<p>3 cookies manage the shopping cart experience:</p>

<ul>
<li>woocommerce_items_in_cart </li>
<li>woocommerce_cart_hash</li>
<li>wp_woocommerce_session_</li>
</ul>

<p>(Where wp_woocommerce_session_ will be something like this in practice:)</p>

<ul>
<li>wp_woocommerce_session_e235b4c0280f7763c7ffd1dd8492f8a2</li>
</ul>

<p>(ref: <a href="https://docs.woothemes.com/document/woocommerce-cookies/" rel="nofollow">https://docs.woothemes.com/document/woocommerce-cookies/</a>)</p>

<p>I modified the function wc_setcookie in the file: includes/wc-core-functions.php to set the cookies for both domains|paths with the following:</p>

<p>A normal cookie is set in this function via: </p>

<ul>
<li>setcookie( $name, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );</li>
</ul>

<p>I will add an additional cookie (for each cookie set with:</p>

<ul>
<li>$temp1 = get_blog_details();</li>
<li>setcookie( $name, $value, $expire, $temp1->path, $temp1->domain, $secure );</li>
</ul>

<p>However these secondary cookies are not seen when going to the other domain path.</p>

<p>So the question is how can I accomplish execute this via extra coding or server modifications in NGINX or with both.</p>

<p>Thank you for your time</p>