• Resolved vuthanhcong96

    (@vuthanhcong96)


    Hi,
    I’m having a problem with the wordpress wc_setcookie function.
    Once the page is cached, I use the wc_setcookie( ‘woocommerce_recently_viewed’, implode( ‘|’, $viewed_products ),$expire ); however, when I check with F12 on the Browser, I don’t see the cookie: woocommerce_recently_viewed
    If the page is not cached or the page uses ESI, then F12 on the Browser will have a Cookie.
    Can you tell me how can i use wc_setcookie function for cached page?
    Thank you!

Viewing 1 replies (of 1 total)
  • Use AJAX or Javascript to set the cookie. If it is not possible and cookie must set by any PHP function there is no way to do it. A cached page is just a static copy of the output and has no more PHP interpretor.

Viewing 1 replies (of 1 total)

The topic ‘The wc_setcookie function does not work when the page is cached’ is closed to new replies.