cart

Show SKU on cart and checkout pages in Woocommerce 3

若如初见. 提交于 2020-08-22 06:38:32
问题 I would like to display SKU on cart (Under product column ) and checkout page. I searched SO, but all answers are for old versions of WooCommerce and non of them is for 3.x. How can I show SKU on cart and checkout pages in Woocommerce 3? 回答1: 2020 Update: How display product SKU directly under item name in WooCommerce? You can do it with a custom unction hooked in woocommerce_cart_item_name action hook, this way: add_filter( 'woocommerce_cart_item_name', 'showing_sku_in_cart_items', 99, 3 );

Shipping calculator state field change trigger update in WooCommerce cart [closed]

独自空忆成欢 提交于 2020-08-10 19:18:15
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 months ago . Improve this question In the code below, I am trying to auto update the shipping calculator in WooCommerce cart page cart page when the selected state field is changed, to display shipping cost by state region: add_action('wp_footer', 'state_update_checkout', 50); function state

Unable to delete or increase cart count

筅森魡賤 提交于 2020-08-10 18:53:10
问题 On a cart page, there are two icons plus and minus to increase and decrease the count respectively. when I use to increase the count, it appends a new array into the array instead of an object. The increase code is case 'ADD_TO_CART': { const updatedCart = [...state.cart]; const item = updatedCart.find(x=>x.key===action.payload.key); if(item) { item.count++; } else{ updatedCart.push(action.payload); } return { ...state, cart: updatedCart, total: state.total + 1 } } For decrease, the code is

WooCommerce discount: buy one get one 50% off with a notice

自作多情 提交于 2020-07-27 23:40:47
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

落爺英雄遲暮 提交于 2020-07-27 23:29:45
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

[亡魂溺海] 提交于 2020-07-27 23:26:20
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

老子叫甜甜 提交于 2020-07-27 23:26:11
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

WooCommerce discount: buy one get one 50% off with a notice

爱⌒轻易说出口 提交于 2020-07-27 23:23:35
问题 After my previous question WooCommerce discount: buy one get one 50% off I want to add custom notice to the cart, whenever a particular product(not all the products) gets added to the cart. I want to check the quantity first, if it's 1 then I want to display a notice to increase the quantity of that product. I have figured something by myself from the internet and I don't think my solution is right: add_action( 'wp', 'sp_custom_notice' ); function sp_custom_notice() { if ( is_admin() && !

Exclude certain categories when automatically adding products to the cart WooCommerce

冷暖自知 提交于 2020-07-16 03:25:32
问题 In WooCommerce, I use a code that auto adds packaging when adding any dish to the cart. function add_delivery_charge_to_cart( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' ) >= 2 ) return; $lunchbox_id = 5737; // "LunchBox" to be added to cart $pakket_id = 5738; // "Pakket" to be added to cart // Loop through cart items foreach ( $cart->get_cart() as $cart_item_key => $cart_item ) { // Check if "LunchBox" product is

WooCommerce minimum order fee for products in specific category

时光总嘲笑我的痴心妄想 提交于 2020-07-03 05:27:25
问题 I want to add a fee in my woocommerce store for orders under a specific amount (value, not quantity). I am using "WooCommerce dynamic minimum order amount based fee" answer code that works perfectly. Now I am trying to change this functionand to apply it only to items from a specific product category. Basically, I have to sum the value of all the products in cart that matches the specific category and use this value for fee calculation. How can I reach this goal? 回答1: The following revisited