cart

Shipping calculated on cart items weight and cart amount

跟風遠走 提交于 2020-01-21 10:05:06
问题 In a client WooCommerce web site, free shipping method is enabled for orders amount up to 250. I use the code below (from this answer) , to hide other shipping rates when the order amount is over 250, except when there is heavy items in cart. add_filter( 'woocommerce_package_rates', 'conditionally_hide_other_shipping_based_on_items_weight', 100, 1 ); function conditionally_hide_other_shipping_based_on_items_weight( $rates ) { // targeted weight $target_product_weight = 12; $target_cart_amount

Woocommerce Set Cart Expiration Interval

让人想犯罪 __ 提交于 2020-01-20 06:56:26
问题 I need to increase the expiration time of Woocommerce cart to 72 hours. I've tried the solution suggested here: set wordpress woocommerce cart expiration But I can't see any result :( Can anyone help me to get this working? Thanks -- Edit: Code snippet --- add_filter('wc_session_expiring', 'filter_ExtendSessionExpiring' ); add_filter('wc_session_expiration' , 'filter_ExtendSessionExpired' ); function filter_ExtendSessionExpiring($seconds) { return (60 * 60 * 24 * 4) - (60 * 60); } function

Woocommerce Set Cart Expiration Interval

柔情痞子 提交于 2020-01-20 06:56:08
问题 I need to increase the expiration time of Woocommerce cart to 72 hours. I've tried the solution suggested here: set wordpress woocommerce cart expiration But I can't see any result :( Can anyone help me to get this working? Thanks -- Edit: Code snippet --- add_filter('wc_session_expiring', 'filter_ExtendSessionExpiring' ); add_filter('wc_session_expiration' , 'filter_ExtendSessionExpired' ); function filter_ExtendSessionExpiring($seconds) { return (60 * 60 * 24 * 4) - (60 * 60); } function

Woocommerce cart deposit

寵の児 提交于 2020-01-16 04:01:07
问题 I have this code for Woocommerce orders, basically a deposit fee per order. But the customer should only be able to pay this fee and the rest later. There are heaps of solutions for product based deposit fees, but not per cart. Any ideas, thoughts on how to force this on checkout and the rest later? add_action( 'woocommerce_cart_calculate_fees', 'booking_fee' ); function booking_fee() { global $woocommerce; if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; $bookingfee_array = array(

WooCommerce: change product image permalink with filter/action hook

ぐ巨炮叔叔 提交于 2020-01-16 02:53:08
问题 I am looking for a filter/action hook (or any other way) to change image URL that is displayed on cart page as a thumbnail. Example image: http://jamescollings.co.uk/wp-content/uploads/2014/12/cart-donation-form.png I found that it is retrieved via $_product->get_image() method, but I could not find anything similar to $_product->set_image() . 回答1: I have found the answer: The hook is woocommerce_cart_item_thumbnail . So in your functions.php add function custom_new_product_image($a) { $class

Show only specific Woocommerce Bookings meta data in cart items

浪尽此生 提交于 2020-01-14 03:05:27
问题 I amusing WooCommerce and with WooCommerce Bookings plugin. In their documentation there's this solution for booking multiple items by using the "persons" quantity. So what the Bookings plugins does, it ads meta data to the variations, it also includes "persons" what we're currently using as an indicator for the amount of items being booked. What we want to next is retrieve the meta data [Persons] from the product variations and display this as the item quantity. What I've done so far is edit

WooCommerce - Getting total products count in the cart - not their quantity

∥☆過路亽.° 提交于 2020-01-12 20:34:50
问题 I have total cart quantity but I need count of products available in the cart. I donot want to show total quantity but want to show total products/orders in the cart. Please help! 回答1: i had same issue in client project @ jivith.com But i resolved ... Use in minicart / cart function replace total products count in the cart - not their quantity items $_cartQty = count( WC()->cart->get_cart() ); **or** use sizeof (WC()->cart->get_cart()); i getting the total unique total products count in the

Display an estimated delivery date range based on WooCommerce cart item stock

走远了吗. 提交于 2020-01-12 09:51:12
问题 I am trying to output an estimated delivery date in the cart based on the stock status of the products in the cart. I was a little bit successful but now I am stuck. This is what I have written so far. It goes in the function.php function lieferzeit() { global $woocommerce; $cart_items = $woocommerce->cart->get_cart(); foreach ($cart_items as $variation) { $variation_id = $variation['variation_id']; $variation_obj = new WC_Product_variation($variation_id); $stock = $variation_obj->get_stock

Display an estimated delivery date range based on WooCommerce cart item stock

北城余情 提交于 2020-01-12 09:46:10
问题 I am trying to output an estimated delivery date in the cart based on the stock status of the products in the cart. I was a little bit successful but now I am stuck. This is what I have written so far. It goes in the function.php function lieferzeit() { global $woocommerce; $cart_items = $woocommerce->cart->get_cart(); foreach ($cart_items as $variation) { $variation_id = $variation['variation_id']; $variation_obj = new WC_Product_variation($variation_id); $stock = $variation_obj->get_stock

Make WC_Cart add_to_cart method working for guests in Woocommerce

空扰寡人 提交于 2020-01-11 11:51:48
问题 Im trying to get my code to work. Searching for hours now. I found similar questions like this one. But unfortunately noone seems to find a solution. In my custom plugin I want to add a specific item to the WC cart and redirect the user directly to the checkout. As a logged in user it works like a charm but for guests it shows a blank page on checkout (woocommerce_checkout shortcode seems to return nothing in this case). So I came up with a check if the cart iss till empty. Apparently it is