Woo-commerce cart item session start and destroy after 30 Min.

  • 5 years-11 months

    Woo-commerce cart item session start and destroy after 30 Min.

    • Category : wordpress
    • Viewed : 81 times
    • Posted On :
    • Posted by : Vikas

    woo-commerce cart item session start and destroy after 30 Min

    <?php
    
    global $woocommerce;
    if (!isset($_SESSION['EXPIRES']) || $_SESSION['EXPIRES'] < time()) {
     $woocommerce->cart->empty_cart(); 
    } else {
      $_SESSION['EXPIRES'] = time() 1800;
    }
    

Report this or Ask your own question

Your Answer

When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.