hook-woocommerce

Disable (remove) the marketing menu option in WooCommerce 4.3.x

百般思念 提交于 2021-01-01 04:23:17
问题 Since the release of WooCommerce 4.3.x , the previous fix for removing the Marketing menu option that worked with 4.1.x does not work anymore and I'm wondering if anyone knows how to remove it for 4.3.x . I've tried all of these without success: #1: add_filter( 'woocommerce_marketing_menu_items', '__return_empty_array' ); #2: add_action( 'admin_init', 'remove_wc_marketing_menu_item' ); function remove_wc_marketing_menu_item() { remove_menu_page( 'admin.php?page=wc-admin&path=/marketing' ); }

Split cart items when quantity is updated on cart page in WooCommerce

两盒软妹~` 提交于 2020-12-13 12:08:49
问题 I want to split cart items of same product in individual lines. When I increase quantity on single product page and add to cart, it shows as separate cart items. Im using WooCommerce - Treat cart items separate if quantity is more than 1 answer code. I want when quantity is updated on cart page and clicked on 'Update cart', then items must split on individual lines. How can I do that? 回答1: The code below will split items on individual lines when quantity is updated on the cart page. Comment

Split cart items when quantity is updated on cart page in WooCommerce

 ̄綄美尐妖づ 提交于 2020-12-13 12:07:13
问题 I want to split cart items of same product in individual lines. When I increase quantity on single product page and add to cart, it shows as separate cart items. Im using WooCommerce - Treat cart items separate if quantity is more than 1 answer code. I want when quantity is updated on cart page and clicked on 'Update cart', then items must split on individual lines. How can I do that? 回答1: The code below will split items on individual lines when quantity is updated on the cart page. Comment

Add checkbox to WooCommerce checkout page based on custom “woocommerce_variation_option”

你说的曾经没有我的故事 提交于 2020-12-13 08:02:39
问题 I've added an additional variation option to my products with the following code: add_action('woocommerce_variation_options', 'he_add_to_variation_option', 10, 3); function he_add_to_variation_option( $loop, $variation_data, $variation){ $is_trial = (get_post_meta($variation->ID, '_trialversion', true)) ? ' checked' : ''; ?> <label class="tips" data-tip="<?php esc_attr_e( 'Enable this option to make as a trial version', 'woocommerce' ); ?>"> <?php esc_html_e( 'Trial Version?', 'woocommerce' )

Assign custom field price as product price to specific user role in WooCommerce

心已入冬 提交于 2020-12-12 18:17:50
问题 I created a new role called "Wholesaler". The role works as expected. I also created a custom price field called "Wholesaler price". It also works as expected. I check the user role, if they are assigned as a wholesaler, I give them the custom product price (if it is filled in). I have everything working except I can't figure out the final piece. How do I pull the current product ID, get the wholesale price, and assign it. My functions.php code is below: /* Custom user roles */ add_role(

How to limit the number of orders per customer via a time limit in WooCommerce

半城伤御伤魂 提交于 2020-12-12 11:57:32
问题 I want to prevent selling each 24 hour by a customer. check if there are other purchases from that costumer at the past 24hr and display an error before payment and ask to return later What I have tried so far function prevent_repeat_order() { $last_24_hours_from_order_results = wc_get_customer_last_order($user_id); (array( 'date_created' => '>=' . (time() - 86400), // time in seconds 'paginate' => true // adds a total field to the results )); if ( $last_24_hours_from_last_order->total > 1 )

Display product image on Woocommerce My Account Downloads section

…衆ロ難τιáo~ 提交于 2020-12-12 08:26:31
问题 I’ve got a problem that I can’t seem to figure out. I’m trying to add the product image to each item in the my-account/downloads/ section. I have tried multiple codes that I found but none seem to work for me. I am using 3 plugins with all other plugins disabled trying to figure this out. These 3 plugins are required, so I need this to work with all 3 of these plugins activated. The 3 plugins are: Woocommerce Memberships Woocommerce Subscriptions Woocommerce Subscriptions Downloads All my

Display product image on Woocommerce My Account Downloads section

萝らか妹 提交于 2020-12-12 08:26:16
问题 I’ve got a problem that I can’t seem to figure out. I’m trying to add the product image to each item in the my-account/downloads/ section. I have tried multiple codes that I found but none seem to work for me. I am using 3 plugins with all other plugins disabled trying to figure this out. These 3 plugins are required, so I need this to work with all 3 of these plugins activated. The 3 plugins are: Woocommerce Memberships Woocommerce Subscriptions Woocommerce Subscriptions Downloads All my

How to add custom stock status to products in WooCommerce 4+

試著忘記壹切 提交于 2020-11-29 02:48:19
问题 I am using the following code to add new stock statuses in WooCommerce 4.0. The new statuses are: Preorder Contact us function add_custom_stock_type() { ?> <script type="text/javascript"> jQuery(function(){ jQuery('._stock_status_field').not('.custom-stock-status').remove(); }); </script> <?php woocommerce_wp_select( array( 'id' => '_stock_status', 'wrapper_class' => 'custom-stock-status', 'label' => __( 'Stock status', 'woocommerce' ), 'options' => array( 'instock' => __( 'Available',

How can I change “Your order” text on checkout page in WooCommerce under certain conditions

六眼飞鱼酱① 提交于 2020-11-25 03:26:33
问题 With this code I can change "Your Order" text in checkout page. But I need to change if specific product in my cart or virtual product is in my cart. function custom_wc_translations($translated){ $text = array( 'Your order' => 'Your new phrase', 'any other string' => 'New string', ); $translated = str_ireplace( array_keys($text), $text, $translated ); return $translated; } add_filter( 'gettext', 'custom_wc_translations', 20 ); I found this code but for different place for specific product.