Home Forums WoodMart support forum Mark cross-site cookies as Secure to allow setting them in cross-site contexts

Mark cross-site cookies as Secure to allow setting them in cross-site contexts

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #347792

    gads
    Participant

    Hi, This problem has been around for about 2 months. I tried many ways, I did research on your forum, but I could not reach a result.

    This error same site error

    #347827

    gads
    Participant

    woodmart/inc/integrations/woocommerce/modules/compare.php:54
    setcookie( $cookie_name, json_encode( $products ), 0, COOKIEPATH, COOKIE_DOMAIN, false, false );
    to change this
    setcookie( $cookie_name, json_encode( $products ), 0, COOKIEPATH, COOKIE_DOMAIN, true, false );

    this problem is solved.

    #347829

    gads
    Participant

    Wishlist samesite error ;
    woodmart/inc/integrations/woocommerce/modules/wishlist/functions.php:60
    setcookie( $name, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, false, false );
    to change this
    setcookie( $name, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, true, false );

    for child functions.php;

    //Wishlist samesite giderir.
    if ( function_exists( 'woodmart_set_cookie' ) ) {
    	/**
    	 * Set cookies.
    	 *
    	 * @since 1.0.0
    	 *
    	 * @param string $name Name.
    	 * @param string $value Value.
    	 */
    	function woodmart_set_cookie( $name, $value ) {
    		$expire = time() + intval( apply_filters( 'woodmart_session_expiration', 60 * 60 * 24 * 7 ) );
    		setcookie( $name, $value, $expire, COOKIEPATH, COOKIE_DOMAIN, true, false );
    		$_COOKIE[ $name ] = $value;
    	}
    }
    
    //Karşılaştırdaki samesite error sorununu çözer.
    if ( function_exists( 'woodmart_add_to_compare' ) ) {
    	/**
    	 * Add product to comapre
    	 *
    	 * @since 3.3
    	 */
    	function woodmart_add_to_compare() {
    		$id = sanitize_text_field( $_GET['id'] );
    
    		if ( defined( 'ICL_SITEPRESS_VERSION' ) && function_exists( 'wpml_object_id_filter' ) ) {
    			global $sitepress;
    			$id = wpml_object_id_filter( $id, 'product', true, $sitepress->get_default_language() );
    		}
    
    		$cookie_name = woodmart_compare_cookie_name();
    
    		if ( woodmart_is_product_in_compare( $id ) ) {
    			woodmart_compare_json_response();
    		}
    
    		$products = woodmart_get_compared_products();
    
    		$products[] = $id;
    
    		setcookie( $cookie_name, json_encode( $products ), 0, COOKIEPATH, COOKIE_DOMAIN, true, false );
    
    		$_COOKIE[$cookie_name] = json_encode( $products );
    
    		woodmart_compare_json_response();
    	}
    
    	add_action( 'wp_ajax_woodmart_add_to_compare', 'woodmart_add_to_compare' );
    	add_action( 'wp_ajax_nopriv_woodmart_add_to_compare', 'woodmart_add_to_compare' );
    }
    • This reply was modified 2 years, 9 months ago by gads.
    #347856

    gads
    Participant

    Latest page speed(Litespeed) and samesite error fix.
    Mobile
    Page Speed
    Desktop
    Page Speed

    Attachments:
    You must be logged in to view attached files.
    #347992

    Artem Temos
    Keymaster

    Hello,

    Thank you for contacting us!

    We will review your fix and implement it in our next theme update. Thank you for the report.

    Kind Regards

Viewing 5 posts - 1 through 5 (of 5 total)