Home › Forums › WoodMart support forum › Mark cross-site cookies as Secure to allow setting them in cross-site contexts › Reply To: Mark cross-site cookies as Secure to allow setting them in cross-site contexts
January 25, 2022 at 1:57 pm
#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 3 years, 1 month ago by
gads.