cart

Fix maximum coupon Discount On Cart percentage in WooCommerce

我的未来我决定 提交于 2019-12-03 20:21:31
I have a coupon code (XYZ25) in woocommerce which include 25% off and maximum discount is Rs.250. How can i restrict user's to not get more than Rs.250 Discount if they apply coupon code XYZ25 for 25% discount. Since Woocommerce 3.2 or 3.3, this code doesn't work anymore You could set an additional coupon FIX250 code based on a fixed cart discount of ** RS.250 (without tax) and with a Minimun spend of (4 x 250) = RS.1000 . Then with the help of the script below, if customer apply your XYZ25 coupon code and if the cart total is up to Rs.1000, it will replace XYZ25 coupon by FIX250 displaying at

Ecommerce::Shopping cart::Where should i store shopping cart data in session or in database

烈酒焚心 提交于 2019-12-03 18:49:16
问题 Where should I store shopping cart data in session or in database? (I think in amazon.com shopping cart after user logout and after month login again his orders that he choose in shopping cart saved) Thanks, Yosef 回答1: Of course shopping cart data is a critical data. Where to save this data it depends on that user which your e-commerce system works. With Not Signed (yet) users - You have to save this data on web storage, html5 gives you ability for this.Simple using Front End Storage, which

magento: URL querystring for adding product and applying discount coupon to cart

二次信任 提交于 2019-12-03 17:36:52
I am a newbie, after extensive research and exploration I am able to figure out the following: To add a product to cart I can use /checkout/cart/add?product= 76 &qty= 1 to apply discount code I can use /checkout/cart/couponPost?coupon_code= WQ9D-XXXX The code for it resides in file: /public_html/app/code/local/Mage/Checkout/controllers/ - I would like to add product and apply discount code in one link such as: /checkout/cart/couponPost?product= 76 &qty= 1 &coupon_code= WQ9D-XXXX OR /checkout/cart/add?product= 76 &qty= 1 &coupon_code= WQ9D-XXXX OR Any other means? Is there a way to get this

Woocommerce - How to remove the Add to Cart Button on product listing

允我心安 提交于 2019-12-03 14:14:49
问题 I'm wanting to remove the Add to Cart Button on the product listing pages. The only place I want it to appear is the individual product page. Can anyone suggest on where I can find to remove this? I haven't been able to get any help from the documentation. At the moment the button appears under every listing. 回答1: I don't know how to do it from WooCommerce but with following code it is possible, just make sure that these PHP code should execute, so, put it at suitable place in PHP file where

Magento - How to get cart items total in header.phtml

孤街浪徒 提交于 2019-12-03 12:18:45
问题 I am using Magento eCommerce and I have modified my header.phtml via the Blank template. Code, this is my code but it shows blank. <?php $cartQty = $this->getSummaryCount() ?> <?php if ($cartQty>0): ?> <?php if ($cartQty==1): ?> <?php echo $this->__('<a class="cartgo" href="%s">(1 ITEM)</a>', $this->getUrl('checkout/cart')) ?> <?php else: ?> <?php echo $this->__('<a class="cartgo" href="%s">(%s ITEMS)</a>', $this->getUrl('checkout/cart')) ?> <?php endif ?> <?php endif ?> 回答1: There was an

Woocommerce - How to remove the Add to Cart Button on product listing

心不动则不痛 提交于 2019-12-03 04:06:18
I'm wanting to remove the Add to Cart Button on the product listing pages. The only place I want it to appear is the individual product page. Can anyone suggest on where I can find to remove this? I haven't been able to get any help from the documentation. At the moment the button appears under every listing. I don't know how to do it from WooCommerce but with following code it is possible, just make sure that these PHP code should execute, so, put it at suitable place in PHP file where some PHP codes are executing, best place would be any wordpress plugin's base file, be careful while

Conditionally set cart item prices for specific products in WooCommerce 3

戏子无情 提交于 2019-12-02 22:22:13
问题 In WooCommerce I am using some code from this answer: Set WooCommerce cart item price to zero if the product has already been bought It works great with one product, but I would like to make it work with several products . So the code below, for a specific product, change the cart item price to $0.00 if customer has already purchased and if not the price is set to $100 (for the first purchase) : add_action( 'woocommerce_before_calculate_totals', 'conditionally_change_cart_items_price', 10, 1

Adding Woocommerce Brands names to cart item product names

江枫思渺然 提交于 2019-12-02 17:35:39
问题 I use the Woocommerce Brands plugin and I would like to add the Brand to each product when it is in the cart, like it displays variations. So Product Name, and then Size: XXX Colour: XXX Brand: XXX I have tried a few ways of doing it but I can't seem to get it to work. 回答1: Update 2 - Code enhanced and optimized (April 2019) Now the way to add brand name(s) just as the product attributes names + values in cart items, is also possible using this custom function hooked in woocommerce_get_item

How to clear an abandoned woocommerce cart

£可爱£侵袭症+ 提交于 2019-12-02 13:55:15
问题 I came across this code for clearing a Woocommerce cart on certain page loads. But, I wonder is there a way to clear the cart after it has been abandoned? For triggering only on front page your function needs to look like this: add_action( 'init', 'woocommerce_clear_cart_url' ); function woocommerce_clear_cart_url() { global $woocommerce; if ( is_front_page() && isset( $_GET['empty-cart'] ) ) { $woocommerce->cart->empty_cart(); } } function is_front_page() returns true only on front page of

Set item quantity to multiples of “x” for products in a specific category in Woocommerce

偶尔善良 提交于 2019-12-02 12:33:11
问题 I found online a snippet that allows you to set in the cart a minimum purchase to multiple quantities of “6”. Here it is: add_action( ‘woocommerce_check_cart_items’, ‘woocommerce_check_cart_quantities’ ); function woocommerce_check_cart_quantities() { $multiples = 6; $total_products = 0; foreach ( WC()->cart->get_cart() as $cart_item_key => $values ) { $total_products += $values['quantity']; } if ( ( $total_products % $multiples ) > 0 ) wc_add_notice( sprintf( __('You need to buy in