Cart::set_cart_id( string $cart_id )
Summary
Set the cookie that contains the cart ID
Parameters
- $cart_id
-
(string) (Required)
Return
(void)
Source
File: src/BigCommerce/Cart/Cart.php
public function set_cart_id( $cart_id ) { /** * Filter how long the cart cookie should persist * * @param int $lifetime The cookie lifespan in seconds */ $cookie_life = apply_filters( 'bigcommerce/cart/cookie_lifetime', 30 * DAY_IN_SECONDS ); $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) ); setcookie( self::CART_COOKIE, $cart_id, time() + $cookie_life, COOKIEPATH, COOKIE_DOMAIN, $secure ); $_COOKIE[ self::CART_COOKIE ] = $cart_id; }