hook-woocommerce

Minimum cart amount except for specific products in WooCommerce

老子叫甜甜 提交于 2020-06-16 03:51:02
问题 I only permit oders with a minimum value of 15€ on my site, but want to make an exception for one product. I would really appreciated if someone knows how to help me on this. The coding for the minimum order value is below. Anyone know how I can adapt this to exclude one product via a product ID? add_action( 'woocommerce_check_cart_items', 'wc_set_min_total' ); function wc_set_min_total() { if( is_cart() || is_checkout() ) { global $woocommerce; // Setting the minimum cart total $minimum_cart

Sort products at the bottom of the product list in cart WooCommerce by SKU

坚强是说给别人听的谎言 提交于 2020-06-15 07:28:34
问题 In WooCommerce, I use a code that shows the steak weight selection form, saves the selection data and displays this data in the cart, on the checkout page, when editing the order and in email notifications. My code is also combined with a code that automatically adds packaging when adding any products to the cart. Adding packaging occurs on SKU. /** * Display Custom Checkbox Field */ function steak_custom_field_add() { global $post; // Checkbox woocommerce_wp_checkbox( array( 'id' => '_steak

WooCommerce: Get custom field from product variations and display it on the “additional information area”

与世无争的帅哥 提交于 2020-06-09 03:32:40
问题 I'm trying to add a custom field to product variations, and display the custom field value on products in the "additional information area". I'm working from "WooCommerce: Add Custom Field to Each Product Variation". The custom field is working fine, but I cannot seam to display the value on the product page. This is what I have so far: // 1. Add custom field input @ Product Data > Variations > Single Variation add_action( 'woocommerce_variation_options_pricing', 'Add_custom_field_to

WooCommerce: Get custom field from product variations and display it on the “additional information area”

梦想与她 提交于 2020-06-09 03:26:52
问题 I'm trying to add a custom field to product variations, and display the custom field value on products in the "additional information area". I'm working from "WooCommerce: Add Custom Field to Each Product Variation". The custom field is working fine, but I cannot seam to display the value on the product page. This is what I have so far: // 1. Add custom field input @ Product Data > Variations > Single Variation add_action( 'woocommerce_variation_options_pricing', 'Add_custom_field_to

Allow Specific Product to Bought Alone Woocommerce

时光总嘲笑我的痴心妄想 提交于 2020-05-31 06:33:28
问题 Let's Say I have Product A which is allow to bought alone. If something else already in cart it shows the message. "Not Allow". I tried various methods but not able to find proper solution for that. When somebody tries to click on the "ADD TO CART" button then it must check via code that if other items in cart it is not allow to put in cart and shows the message. PRODUCT A is allow bought alone. I tried with the category comparison and it works. but I want to do only with the Product ID. add

Get top level parent product category as body class in WooCommerce

丶灬走出姿态 提交于 2020-05-30 06:09:07
问题 I need to get the TOP level category (not just the parent category) of a subcategory of products in Woocommerce. I have this code to get the parent category id: if (is_subcategory()) { $term = get_queried_object(); $parent_id = $term->parent; } And this one makes $parent_id as a body class: add_filter( 'body_class', 'parent_id_body_class' ); function parent_id_body_class( $classes ) { // add comprehensive text followed by parent id number to the $classes array $term = get_queried_object();

Get top level parent product category as body class in WooCommerce

大城市里の小女人 提交于 2020-05-30 06:08:46
问题 I need to get the TOP level category (not just the parent category) of a subcategory of products in Woocommerce. I have this code to get the parent category id: if (is_subcategory()) { $term = get_queried_object(); $parent_id = $term->parent; } And this one makes $parent_id as a body class: add_filter( 'body_class', 'parent_id_body_class' ); function parent_id_body_class( $classes ) { // add comprehensive text followed by parent id number to the $classes array $term = get_queried_object();

How to disable shipping method based on item count and a certain category

吃可爱长大的小学妹 提交于 2020-05-28 06:44:36
问题 I have been looking for a way to condtionally disable two shipping methods table rate distance rate Based on the item count. By item count I do not mean quantity, I mean how many different products are in the cart. IE 2 Lamps and 3 tables in the cart would be an item count of 2 and a combined quantity of 5. I would also like to ensure this rule is in effect for a certain category only. I tried: function hide_shipping_count_based( $rates, $package ) { // Set count variable $cart_count = 0; //

How to disable shipping method based on item count and a certain category

妖精的绣舞 提交于 2020-05-28 06:43:12
问题 I have been looking for a way to condtionally disable two shipping methods table rate distance rate Based on the item count. By item count I do not mean quantity, I mean how many different products are in the cart. IE 2 Lamps and 3 tables in the cart would be an item count of 2 and a combined quantity of 5. I would also like to ensure this rule is in effect for a certain category only. I tried: function hide_shipping_count_based( $rates, $package ) { // Set count variable $cart_count = 0; //

Sort products at the bottom of the product list in cart WooCommerce by product ID

那年仲夏 提交于 2020-05-27 12:43:13
问题 In WooCommerce, I use a code that auto adds packaging when adding any dish to the cart. The functionality is as follows: dish is in the shopping cart, 1 lunch box is added dishes are in the shopping cart, 2 lunch boxes are added dishes are in the shopping cart, 3 lunch boxes are added There are 3 lunch boxes, so now 1 package is added function add_delivery_charge_to_cart( $cart ) { if ( is_admin() && ! defined( 'DOING_AJAX' ) ) return; if ( did_action( 'woocommerce_before_calculate_totals' )