Skip to content

Commit 54c98d2

Browse files
committed
gspc-clear-stale-entries-on-load.php: Added snippet to clear stale entries on site load.
1 parent 26aefd9 commit 54c98d2

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
/**
3+
* Gravity Shop // Product Configurator // Clear stale Entries on load
4+
* https://gravitywiz.com/documentation/gravity-shop-product-configurator/
5+
*
6+
* Although stale entries are cleared via the `woocommerce_cleanup_sessions` cron schedule that runs twice daily,
7+
* this snippet will clear the stale entries on site load.
8+
*/
9+
10+
add_action( 'woocommerce_set_cart_cookies', function( $set ) {
11+
if ( ! $set && class_exists( 'GS_Product_Configurator\Entry_Lifecycle' ) ) {
12+
$entry_lifecycle = new GS_Product_Configurator\Entry_Lifecycle();
13+
$entry_lifecycle->cleanup_stale_entries();
14+
}
15+
} );

0 commit comments

Comments
 (0)