最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Woocommerce set cookie after a sale

programmeradmin2浏览0评论
Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

I am trying to make my custom cookie to remain on all pages when triggered...

add_action('woocommerce_thankyou', 'my_setcookie');

function my_setcookie(){
  $path = parse_url(get_option('siteurl'), PHP_URL_PATH);
  $host = parse_url(get_option('siteurl'), PHP_URL_HOST);
  $expiry = strtotime('+2 days');
  setcookie('madeorder', 'yes', $expiry, $path, $host);
}

it successfully triggers on thank you page, but when i navigate to another page it is gone...

Have i done something wrong?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论