cart

Empty cart once a user leaves a certain page in Woocommerce

萝らか妹 提交于 2020-06-29 04:33:46
问题 So we're building a site that has a custom page that's calling the items in a WooCommerce cart. But what we wanted to do is empty that cart once a user leaves that page. Is this possible? We found this code that will maybe help us but we kept getting a fatal error when we go to the admin page and this only seems to happen when we go to the admin section: Fatal error: Call to a member function empty_cart() on null in /home/client/public_html/wp-content/themes/wp-theme/functions.php on line 746

Display minimum weight and remaining weight message on cart and checkout page for specific category - WooCommerce

你离开我真会死。 提交于 2020-06-28 06:10:20
问题 Inspired from Minimum cart amount for specific product categories in WooCommerce I have the following code , I would have liked it applied to the category (slug: special-box) and hide the "proceed to check out button" until the minimum is reached. add_action( 'woocommerce_check_cart_items', 'checkout_required_min_weight_mood' ); function checkout_required_min_weight_mood () { // soltanto sulle pagine carrello e check out if( ! ( is_cart() || is_checkout() ) ) return; // qui il minimo del peso

Add or remove specific cart Item based on WooCommerce cart total

佐手、 提交于 2020-06-23 08:43:05
问题 I am trying to add a free product to the cart if the order total is above $199.99 I have achieved this and it is working. The issue is that I need to remove the product if the user then deletes an item from the cart and goes below $199.99 again (to prevent gaming the system). What I have seems to be working. The problem is that it seems I need to click 2 links before the REMOVE FROM CART action seems to be working (or refresh the page). What is causing this? Can the remove action be

Replace Qty in cart for Bookable Product at the backend with persons for all subsequent actions

梦想与她 提交于 2020-06-17 09:42:16
问题 I am using the following code to replaced the quantity column in cart with persons for bookable products (i am using WooCommerce Bookings plugin). However, it only changes the cart Qty in the front end but other actions like shipping costs / cart fees set based on qty in cart is not getting updated. Can i add some more code to the above to even replace the qty with persons at the backend for other operations like shipping cost and cart fees. function replace_cart_quantity_for_bookings(

Minimum cart amount except for specific products in WooCommerce

你。 提交于 2020-06-16 03:51:12
问题 I only permit oders with a minimum value of 15€ on my site, but want to make an exception for one product. I would really appreciated if someone knows how to help me on this. The coding for the minimum order value is below. Anyone know how I can adapt this to exclude one product via a product ID? add_action( 'woocommerce_check_cart_items', 'wc_set_min_total' ); function wc_set_min_total() { if( is_cart() || is_checkout() ) { global $woocommerce; // Setting the minimum cart total $minimum_cart

Minimum cart amount except for specific products in WooCommerce

老子叫甜甜 提交于 2020-06-16 03:51:02
问题 I only permit oders with a minimum value of 15€ on my site, but want to make an exception for one product. I would really appreciated if someone knows how to help me on this. The coding for the minimum order value is below. Anyone know how I can adapt this to exclude one product via a product ID? add_action( 'woocommerce_check_cart_items', 'wc_set_min_total' ); function wc_set_min_total() { if( is_cart() || is_checkout() ) { global $woocommerce; // Setting the minimum cart total $minimum_cart

Custom form fields in cart and get the data in checkout on Woocommerce

只愿长相守 提交于 2020-06-13 03:47:33
问题 Adding From,To and Message fields in cart page before checkout.I have added some code in cart.php file but after adding that code the cart page is displaying blank. /** * Add the order_comments field to the cart **/ add_action('woocommerce_cart_collaterals', 'order_comments_custom_cart_field'); function order_comments_custom_cart_field() { echo '<div id="cart_order_notes">'; ?> <div class="customer_notes_on_cart"> <label for="customer_notes_text"><?php _e('Order notes','woocommerce'); ?> <

Custom form fields in cart and get the data in checkout on Woocommerce

核能气质少年 提交于 2020-06-13 03:46:49
问题 Adding From,To and Message fields in cart page before checkout.I have added some code in cart.php file but after adding that code the cart page is displaying blank. /** * Add the order_comments field to the cart **/ add_action('woocommerce_cart_collaterals', 'order_comments_custom_cart_field'); function order_comments_custom_cart_field() { echo '<div id="cart_order_notes">'; ?> <div class="customer_notes_on_cart"> <label for="customer_notes_text"><?php _e('Order notes','woocommerce'); ?> <

Change wc_empty_cart_message function in Woocommerce 3.1

 ̄綄美尐妖づ 提交于 2020-06-10 05:16:18
问题 I've been trying to change my layout for the empty-cart message. I've removed the action, and try to replace it. I'd like to change the htm structure output from: <p class="empty-cart"></p> to: <div class="col-12 offset-md-1 col-md-10"><p class="empty-cart"></p></div> My actual code (in functions.php file of my theme) : /** Change the output for empty-cart within a div */ remove_action( 'wc_empty_cart_message', 'wc_empty_cart_message', 10 ); add_action( 'wc_empty_cart_message', 'wc_empty_cart

Change wc_empty_cart_message function in Woocommerce 3.1

喜夏-厌秋 提交于 2020-06-10 05:15:08
问题 I've been trying to change my layout for the empty-cart message. I've removed the action, and try to replace it. I'd like to change the htm structure output from: <p class="empty-cart"></p> to: <div class="col-12 offset-md-1 col-md-10"><p class="empty-cart"></p></div> My actual code (in functions.php file of my theme) : /** Change the output for empty-cart within a div */ remove_action( 'wc_empty_cart_message', 'wc_empty_cart_message', 10 ); add_action( 'wc_empty_cart_message', 'wc_empty_cart