Created
July 23, 2024 08:11
-
-
Save xlplugins/3cfaa351b14cd656632b21f2e2e3d695 to your computer and use it in GitHub Desktop.
open slide cart by get parameter
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
class FKCartUpdater23072024 { | |
public function __construct() { | |
add_action( 'wp', [ $this, 'checkForCartOpen' ] ); | |
} | |
public function checkForCartOpen() { | |
if ( isset( $_GET['fkcart_open'] ) ) { | |
add_action( 'wp_footer', [ $this, 'addCartUpdateScript' ] ); | |
} | |
} | |
public function addCartUpdateScript() { | |
?> | |
<script> | |
window.addEventListener('load', function () { | |
jQuery(document.body).trigger('fkcart_update_side_cart', [true]); | |
}); | |
</script> | |
<?php | |
} | |
} | |
// Initialize the class | |
new FKCartUpdater23072024(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use get paramet ?fkcart_open to show slide cart