product-quantity

Custom plus and minus quantity buttons in Woocommerce 3

拟墨画扇 提交于 2019-12-18 05:05:07
问题 I’m building custom WordPress and WooCommerce theme and adding custom plus and minus buttons to Product page quantity field . The buttons do update quantity input's value and I also receive "Item has been added to your cart" notification (on Product page) when I submit Add to Cart. But the cart page doesn’t show any items, neither says the cart is empty. I can not work out which WooCommerce JS function I’m suppose to hook into, neither how to hook into it. Could I ask for help please?! Thanks

Change the cart item quantity for specific products in woocommerce

天大地大妈咪最大 提交于 2019-12-13 12:29:59
问题 Can I change WooCommerce quantity in some specific product? I have tried: global $woocommerce; $items = $woocommerce->cart->get_cart(); foreach($items as $item => $values) { $_product = $values['data']->post; echo "<b>".$_product->post_title.'</b> <br> Quantity: '.$values['quantity'].'<br>'; $price = get_post_meta($values['product_id'] , '_price', true); echo " Price: ".$price."<br>"; } How to get specific product Id in cart? 回答1: To change quantities, see after that code. Here your revisited

How to move quantity input box on archive page?

*爱你&永不变心* 提交于 2019-12-13 03:56:49
问题 In our Woocommerce website, we are using the Quantity Field on Shop Page for WooCommerce plugin. However, we don't like the position of the quantity box and want to move it so that it is directly below the "add to basket" button on our products. This is the display that I get: Below is the code of content-product.php template file: <?php /** * The template for displaying product content within loops * * This template can be overridden by copying it to yourtheme/woocommerce/content-product.php

Weeks that overlap a year SQL

偶尔善良 提交于 2019-12-12 02:48:33
问题 I'm currently working on a huge report and need some help on a vital part which I've been on for ironically weeks I have a report that calculates quantity based on a few things but what im trying to do is when the "PREQuantity" column is null and week of year = 1 then get quanitity from week of year 52 for the previous year the case statement is unfinished i know, but essentially i need the report to force in week 52 of the previous year for the prequantity SELECT DR.DivNo ,p.[ProductCode] ,p

Add to cart and redirect to checkout for variable products in WooCommerce

耗尽温柔 提交于 2019-12-11 04:48:34
问题 I got help in this answer thread that allow to add an additional add-to-cart button that redirects to checkout. It works fine for simple products. But how to make it work for variable products as well? I've been trying myself, but no matter what I do, I break the site. I simply do not understand how to make this work with/ for variable products. Here's the lightly changed code that works for simple products and which takes the quantity field into consideration: add_action( 'woocommerce_after

Which Hook to alter quantity update in WooCommerce cart page?

无人久伴 提交于 2019-12-11 04:09:17
问题 I'm trying to fire a function when the quantity of a product is changed in cart. More specifically I want to run this function when a customer modify the amount in a cart. I'm looking to find the amount left in a cart then to intercept the update cart event Currently I'm using: add_action( 'woocommerce_remove_cart_item', 'my function'); When I press "update_cart", it doesn't seem to work. Any advice? Thank you! 回答1: You should use woocommerce_after_cart_item_quantity_update action hook that

additional add to cart button with fixed quantity in woocommerce single product pages

帅比萌擦擦* 提交于 2019-12-08 14:16:05
问题 With woocommerce enabled, we sell wine on our e-shop. I would like an additional button so that customer can buy a case of wine (12 bottles) rather than having to select qty= 12 . I would like to stick the button after the 'add to cart' button on each single product page. Until now I can't find exactly the way to do it. 回答1: It can be done easily with a custom hooked function displaying an additional button that will add 12 products on 1 click on single product pages for simple products only:

Disable WooCommerce Payment methods if cart item quantity limit is reached

天大地大妈咪最大 提交于 2019-12-08 05:21:07
问题 Is there a way or filter to disable selective payment methods if cart quantity increase more than "X number of items" example "15"? I know we can limit max number of quantity before adding to cart but I want to disable some payment methods only. Thanks 回答1: You can use a custom function hooked in woocommerce_available_payment_gateways filter hook. You will have to set inside it your quantity limit and your payment methods slugs. Here is that code: add_filter('woocommerce_available_payment

Progressive fixed Coupon Discount based on specific product quantity in Woocommerce

帅比萌擦擦* 提交于 2019-12-06 20:38:46
I have one little problem that dont know how to fix myself. I want to use this logic into my Woocommerce store just for one product. I have use link like this to autmatically apply coupon code and add to cart: https://testsite.com/checkout/?add-to-cart=Product_ID&quantity=1&coupon=Coupon_Code and this seems to work, when quantity is 1. But i want discount (30%) that is automatically placed when click on direct link from before, to make dynamic, for ex: Increase quantity to 2 in cart page, and coupon automatically to calculate 2 x 30$ = 60$ discount, buy 3 from same product, and calculate 3 X

Disable WooCommerce Payment methods if cart item quantity limit is reached

百般思念 提交于 2019-12-06 15:20:41
Is there a way or filter to disable selective payment methods if cart quantity increase more than "X number of items" example "15"? I know we can limit max number of quantity before adding to cart but I want to disable some payment methods only. Thanks You can use a custom function hooked in woocommerce_available_payment_gateways filter hook. You will have to set inside it your quantity limit and your payment methods slugs. Here is that code: add_filter('woocommerce_available_payment_gateways', 'unsetting_payment_gateway', 10, 1); function unsetting_payment_gateway( $available_gateways ) { //