cart

Additional price based on cart item count in WooCommerce

99封情书 提交于 2020-02-06 04:11:52
问题 Based on "woocommerce change price in checkout and cart page" answer code that change the total price in checkout page, I have added some extra code to count the products that user have in cart and if user had like 9 products in cart then add some price to total: add_action( 'woocommerce_before_cart_totals', 'custom_cart_total' , 'get_cart_contents_count'); function custom_cart_total() { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if (WC()->cart->get_cart_contents_count() == 9){ WC

How to remove order total from cart and checkout page woocommerce

主宰稳场 提交于 2020-01-30 07:41:28
问题 I would like to remove order total block on cart and checkout page. I am not able to find any action or filter to remove order total. I don't want to use css to hide this column. 回答1: Using hooks: 1) Remove cart totals: // On cart page add_action( 'woocommerce_cart_collaterals', 'remove_cart_totals', 9 ); function remove_cart_totals(){ // Remove cart totals block remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 ); // Add back "Proceed to checkout" button (and hooks

How to remove order total from cart and checkout page woocommerce

喜你入骨 提交于 2020-01-30 07:40:02
问题 I would like to remove order total block on cart and checkout page. I am not able to find any action or filter to remove order total. I don't want to use css to hide this column. 回答1: Using hooks: 1) Remove cart totals: // On cart page add_action( 'woocommerce_cart_collaterals', 'remove_cart_totals', 9 ); function remove_cart_totals(){ // Remove cart totals block remove_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 ); // Add back "Proceed to checkout" button (and hooks

Display message based on cart items count in WooCommerce cart

◇◆丶佛笑我妖孽 提交于 2020-01-30 02:43:36
问题 I'd like to display a message in either woocommerce_before_cart or woocommerce_before_cart_table if the total number of items in the cart is less than X, and also display the difference. By items I mean individual quantities not product lines. How can I add a function that sums the quantities of all items in the cart and displays a message if the total is less than the specified quantity? Example: Set the number to 30, cart contains a total of 27 items, so a message would say 'If you order 3

If product has variation Disable the Quantity in Woocommerce mini cart

末鹿安然 提交于 2020-01-25 20:35:09
问题 In My theme there If the product has variation Is show some thing like 1x$18=$18 how to remove the Quantity if the product has variations. I need Something Like pack x $18 =$18 but If the Product has no variation it show as it is . Is there any "If condition to apply for variation"? Please help me. <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key )

If product has variation Disable the Quantity in Woocommerce mini cart

天涯浪子 提交于 2020-01-25 20:34:19
问题 In My theme there If the product has variation Is show some thing like 1x$18=$18 how to remove the Quantity if the product has variations. I need Something Like pack x $18 =$18 but If the Product has no variation it show as it is . Is there any "If condition to apply for variation"? Please help me. <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key )

If product has variation Disable the Quantity in Woocommerce mini cart

我怕爱的太早我们不能终老 提交于 2020-01-25 20:34:06
问题 In My theme there If the product has variation Is show some thing like 1x$18=$18 how to remove the Quantity if the product has variations. I need Something Like pack x $18 =$18 but If the Product has no variation it show as it is . Is there any "If condition to apply for variation"? Please help me. <?php echo apply_filters( 'woocommerce_widget_cart_item_quantity', '<span class="quantity">' . sprintf( '%s × %s', $cart_item['quantity'], $product_price ) . '</span>', $cart_item, $cart_item_key )

Checkbox field that add / remove a custom fee in WooCommerce

会有一股神秘感。 提交于 2020-01-25 00:45:18
问题 Need to add custom fee to cart based on form checkbox element. Current action based on product category in cart works great and adds custom delivery fee but customer has option to pickup order which is free. Can checkbox checked for delivery trigger WooCommerce add custom fee action? Using example from "perform an action on checkbox checked or unchecked event on html form" can .change(function) function delivery(id){ if(this.checked) { add_action for custom cart fee? add_action( 'woocommerce

Decrease product quantity in database after order is placed with Laravel

落爺英雄遲暮 提交于 2020-01-23 13:09:59
问题 I have cart on the site and so far everything work perfectly. Now I'm trying to make quantity for each product which admin can add in backend ( already done ) and when customer order product(s) to decrease quantity in database. So far as I said admin panel is ready and can add quantity to product which is saved in database. Here is my cart submit controller public function orderSubmit() { $cart = Session::get(self::CART_SESSION_KEY, array()); if (count($cart) < 1) { return Redirect::to('/');

WooCommerce dynamic minimum order amount based fee

岁酱吖の 提交于 2020-01-23 11:53:26
问题 I need to set a minimum order fee in the shopping cart so if products in the cart don't total more than £10 then an extra fee is applied to bring the price up to £10. Here is the code I have at the moment which works well in the cart phase however when you reach the checkout the pricing section doesn't stop loading for some reason and you can't checkout, can anyone help? Code from functions.php: function woocommerce_custom_surcharge() { global $woocommerce; if ( is_admin() && ! defined(