Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am using woocommerce in wordpress site.
I need to clear cart contents of a logged in user when that user logs out.
I am unable to find any options for the same in plugin settings.
Anyone let me know a way to achieve the same.
Use wp_logout hook to empty the cart. Place the below code in your theme's function.php or in your own plugin.
function your_function() {
if( function_exists('WC') ){
WC()->cart->empty_cart();
}
}
add_action('wp_logout', 'your_function');
Edited: According to #helgatheviking 's solution
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have a wordpress theme of 'Couponis' and I want to edit some code inside a popup window of the coupon when pressing on 'Get Code' but I do not know which file to edit.
here is example of the theme:
http://demo.spoonthemes.net/themes/couponis/home-2/
So how to know which file I should go to
To know which file to edit, simply install the Show Current Template plugin.
Having said that, the best practice to add custom code into a WordPress theme is by creating a child-theme. This method allows your custom code to remain intact when the parent theme is updated. You can find more about child themes here.
I hope you find this useful.
Cheers
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm developing plugin for wordpress and i have already made settings page for admin in dashboard.
now i want to make some kind of button that is available on all pages but admin's pages like login page or 'wp-admin'.
what do you suggest?
Thanks.
You can use the is_admin() function in wordpress to determine whether the current request is directed to an admin page, so:
if(!is_admin()){
//YOUR PUBLIC(NON-ADMIN) ONLY CODE
}
WP codex on this function
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am developing an E-commerce site in WordPress using WooCommerce plugin. By default the users are directed to myaccount page. In my website I want to redirect the users to homepage after login. How can this redirection be done?
This code should solve your problem.You can add this code in functions.php.
add_filter('woocommerce_login_redirect', 'user_redirection_page');
function user_redirection_page( $redirect_to ) {
return esc_url( home_url( '/' ) );
}
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to add custom drop down option in Magento Checkout Page.
I am using fire checkout in my Magento Store.
I am newbie in Magento and not getting where to start.
I have followed this tutorial but not able to figure out anything.
Please let me know which files should be updated and how can I store that option value in database also.
Any help would be appreciated.
Thanks
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
How do I disable or remove add to cart, and checkout functions on OpenCart?
I have a website, and it's like a store catalog. I mean, it is not an online store, so I don't need these functions and would like to disable it, so people can see the price, but they can't buy it online.
As you know, OpenCart is E-commerce software which is meant to sell product online, so there is no feature of removing add to cart.
If you want you can do it in a custom way by disabling the addToCart() operation:
catalog>view>javascript>common::addToCart() comment the operational part
system>library>cart::add() comment the operational part
This will help to disable the function of addToCart().
To remove add to cart button, add script to footer.tpl before </body>:
<script type="text/javascript">
$('.cart, #cart').hide();
</script>