cart

Hide “remove item” from cart for WooCommerce product category

时光毁灭记忆、已成空白 提交于 2019-12-11 11:31:20
问题 I would like to Hide "remove item" from cart for a specific product category in WooCommerce, just like in "Hide "remove item" from cart for a specific product in WooCommerce" answer thread, but for a specific product category. Any help would be appreciated. 回答1: The following code will hide "remove item" from cart for a specific product category (that you will define in the 2nd function) : // Custom conditional function that checks for categories (including parent) function has_product

Custom cart item price calculation based on dimentions custom fields in Woocommerce

一曲冷凌霜 提交于 2019-12-11 10:12:16
问题 I have created some input custom fields in woocommerce single product pages where user can input height and width values respectively… When product is added to cart that custom fields values are displays in cart and checkout page too. Example: if user input height='15' and width='20' then its display is cart page like height=15 width=20 single product page cart page Now what Iém trying to achieve is to make a custom price calculation based on that "height" and "width" custom fields values:

Show the tax line when rate is 0% in Woocommerce

有些话、适合烂在心里 提交于 2019-12-11 10:11:06
问题 I’m updating to the latest version of WooCommerce from a very old version. I have noticed that when using the option “Display tax totals: Itemized”, the Tax name is not displayed anymore in the Sub Total line included in Cart page, Checkout page and in any customer e-mail, invoice, etc. The reason appears to be that if the Tax rate is set to 0.0000%, the new version of WooCommerce automatically hides that line after the Sub Total, look below: If I set rates to 1.0000% or whatever, it appears.

Allow specific products to be purchase only if a coupon is applied in Woocommerce

寵の児 提交于 2019-12-11 09:59:03
问题 I am working on a woocommerce website and I am trying to restrict a product to be purchased only if a coupon is applied for it, so it should not be processed without adding a coupon code. User must enter a coupon code to be able to order this specific product (not on all other products). Any help is appreciated. 回答1: For defined products, the following code will not allow checkout if a coupon is not applied, displaying an error message: add_action( 'woocommerce_check_cart_items', 'mandatory

Add a fee based on cart items height in Woocommerce

走远了吗. 提交于 2019-12-11 09:34:40
问题 I'm trying to find a function that automatically adds a fee to the cart if the height of the products in it is over 2,9 cm. I'm using Woocommerce for our simple non-profit comic bookstore. We use weight based shipping as a standard in Sweden, with a bulky fee if something is 3 cm or over. I've tried modifying this answer of LoicTheAztec regarding fees based on total cart weight, but I really don't know what I'm doing as I am getting a blank page after saving the code. The code I'm trying to

Add Order data in Adword Conversion Code in Woocommerce

守給你的承諾、 提交于 2019-12-11 08:48:51
问题 I have an adwords conversion code which I want to add in my child theme.I want to insert the Total purchase Amount in the "value" attribute in this piece of code so that each time the code is triggered the total amount in cart is added to the conversion. <script async src="https://www.googletagmanager.com/gtag/js?id=AW-806400000"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-806400000"');

Add different custom labels to Woocommerce shipping methods

故事扮演 提交于 2019-12-11 08:34:30
问题 In WooCommerce, I am trying to add "shipping estimates" to my shipping methods (all of them are flat rate type), so it looks like this: Only all the estimated dates are different… My problem is that I can't seem to target specific instances. I can only select entire method (flat rate), I checked for my methods instance ID's, since those are unique: But it only works when I put 0 as a case in php switch method. 2,3,4,5,7 do not work. Here is my code: function sv_shipping_method_estimate_label(

Set a custom calculated price in Woocommerce Before Calculate Totals hook

99封情书 提交于 2019-12-11 08:34:08
问题 So I have setup woocommerce with Advance Seat Reservation Management for WooCommerce plugin but I'm running into pricing issues as the Minicart widget shows the item price divided by 2. Appreciate any help. Here is the related involved plugin code: add_action( 'woocommerce_before_calculate_totals', 'srw_add_custom_price' ); function srw_add_custom_price( $cart_object ){ global $wpdb; foreach( $cart_object->cart_contents as $key => $value ){ $proId = $value['data']->id; if(isset($_SESSION[

Unsetting WooCommerce shipping method based on cart items shipping classes

一曲冷凌霜 提交于 2019-12-11 07:59:01
问题 I’m trying to unset Flat Rate shipping method only if cart has products both with and without shipping class. If all product in cart have shipping class then it should stay. Have this shipping method: Flat Rate - (flat_rate1) (instance_id=1) And these shipping classes: 50, 100 and so on, with same way named Slugs: 50, 100… Flat Rate shipping method has costs set up for these shipping classes, Main Cost and No shipping class cost for this method are not set, so it only appears for products in

Quantity Discount for 2nd Item Based on Product Category in Woocommerce

爷,独闯天下 提交于 2019-12-11 07:51:01
问题 based on "Quantity discount on 2nd item only in Woocommerce" answer code to one of my pervious questions, I would like help on how to add a if statement for has_term() and that way, make this code applicable only for one or more categories. Any track will be appreciated. 回答1: The following will extend your code for defined product categories using WordPress has_tem() conditional function: add_action( 'woocommerce_cart_calculate_fees', 'second_item_discount', 10, 1 ); function second_item