Skip to content

Instantly share code, notes, and snippets.

@AladinDridi
Last active November 6, 2018 23:42
Show Gist options
  • Save AladinDridi/bfbd03bb10b0a52935fda1d1d7255f4e to your computer and use it in GitHub Desktop.
Save AladinDridi/bfbd03bb10b0a52935fda1d1d7255f4e to your computer and use it in GitHub Desktop.
<?php
$product_id=359;
$url='';
//check if product already in cart
if (WC()->cart->get_cart_contents_count() == 0 ) {
WC()->cart->add_to_cart($product_id);
wp_redirect($url);
exit();
}
else{
wp_redirect($url);
exit();
}
?>
<style>
h1{
border-radius:
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment