Created
December 6, 2016 18:02
-
-
Save greguly/08765cf325e4e91176279e67b4534718 to your computer and use it in GitHub Desktop.
Unsetting WooCommerce Session Variables
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* In answer to https://twitter.com/Kathy_Darling/status/805902856536674304 | |
* | |
* Anyone know how to remove a @WooCommerce session variable once you've set it? | |
* | |
*/ | |
// One can set the variable to null, like it is done with wc_notices: | |
WC()->session->set( 'wc_notices', null ); | |
// Or really unset is as in | |
WC()->session->__unset( 'wc_notices' ); | |
// source: https://github.com/woocommerce/woocommerce/blob/release/2.6/includes/abstracts/abstract-wc-session.php#L57 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment