Skip to content

Instantly share code, notes, and snippets.

@xlplugins
Created July 23, 2024 08:11
Show Gist options
  • Save xlplugins/3cfaa351b14cd656632b21f2e2e3d695 to your computer and use it in GitHub Desktop.
Save xlplugins/3cfaa351b14cd656632b21f2e2e3d695 to your computer and use it in GitHub Desktop.
open slide cart by get parameter
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();
@sandeepwisetr
Copy link

use get paramet ?fkcart_open to show slide cart

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment