Title: simplejac's Replies | WordPress.org

---

# simplejac

  [  ](https://wordpress.org/support/users/simplejac/)

 *   [Profile](https://wordpress.org/support/users/simplejac/)
 *   [Topics Started](https://wordpress.org/support/users/simplejac/topics/)
 *   [Replies Created](https://wordpress.org/support/users/simplejac/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/simplejac/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/simplejac/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/simplejac/engagements/)
 *   [Favorites](https://wordpress.org/support/users/simplejac/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
   
   In reply to: [Edit Woo Core function wc_setcookie() for SameSite](https://wordpress.org/support/topic/edit-woo-core-function-wc_setcookie-for-samesite/)
 *  [simplejac](https://wordpress.org/support/users/simplejac/)
 * (@simplejac)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/edit-woo-core-function-wc_setcookie-for-samesite/#post-15891811)
 * Hello,
    I’ve also has this issue, so here’s how I solved it. This is not a perfect
   solution because you’ll need to edit WC core files. So every time you update 
   this code gets over written.
 * In _\wp-content\plugins\woocommerce\includes\wc-core-functions.php_
    On line 
   1041 – 1062
 *     ```
       /**
        * Set a cookie - wrapper for setcookie using WP constants.
        *
        * @param  string  $name   Name of the cookie being set.
        * @param  string  $value  Value of the cookie.
        * @param  integer $expire Expiry of the cookie.
        * @param  bool    $secure Whether the cookie should be served only over https.
        * @param  bool    $httponly Whether the cookie is only accessible over HTTP, not scripting languages like JavaScript. @since 3.6.0.
        */
       function wc_setcookie( $name, $value, $expire = 0, $secure = false, $httponly = false ) {
           if ( ! apply_filters( 'woocommerce_set_cookie_enabled', true, $name ,$value, $expire, $secure ) ) {
               return;
           }
   
           if ( ! headers_sent() ) {
               setcookie($name, $value, ['expires' => 0, 'path' =>  '/', 'domain' => COOKIE_DOMAIN, 'secure' => true, 'httponly' => true, 'samesite' => 'None']);
               //setcookie( $name, $value, $expire, COOKIEPATH ? COOKIEPATH : '/', COOKIE_DOMAIN, $secure, apply_filters( 'woocommerce_cookie_httponly', $httponly, $name, $value, $expire, $secure ) );
           } elseif ( Constants::is_true( 'WP_DEBUG' ) ) {
               headers_sent( $file, $line );
               trigger_error( "{$name} cookie cannot be set - headers already sent by {$file} on line {$line}", E_USER_NOTICE ); // @codingStandardsIgnoreLine
           }
       }
       ```
   
 * Also in _\wp-content\plugins\woocommerce\includes\wc-template-functions.php_
   
   On line 79 – 91
 *     ```
       /**
        * When loading sensitive checkout or account pages, send a HTTP header to limit rendering of pages to same origin iframes for security reasons.
        *
        * Can be disabled with: remove_action( 'template_redirect', 'wc_send_frame_options_header' );
        *
        * @since  2.3.10
        */
       function wc_send_frame_options_header() {
           if ( is_account_page() && ! is_customize_preview() ) {
               send_frame_options_header();
           } else if (isset($_COOKIE["cXMLBC"]) && is_checkout()) { 
               remove_action( 'template_redirect', 'wc_send_frame_options_header' );
           }
       }
       add_action( 'template_redirect', 'wc_send_frame_options_header' );
       ```
   
    -  This reply was modified 3 years, 8 months ago by [simplejac](https://wordpress.org/support/users/simplejac/).

Viewing 1 replies (of 1 total)