hook-woocommerce

How to delete a product from WooCommerce cart if associated product is added [duplicate]

断了今生、忘了曾经 提交于 2021-01-20 13:54:27
问题 This question already has an answer here : Woocomerce Remove a specific cart items when adding to cart another specific items (1 answer) Closed last month . I have setup a WooCommerce shop for sell Ticket for a Dancing Workshop. Everthing is ok, but i will delete Tickets from cart if somebody puts 2 Tickets for Workshops that are at the same time. Example: I have made 10 Tickets for the courses. 5 for Trainer A with Name A1 - A5 5 for Trainer B with Name B1 - B5. Now when somebody add A1 to

WooCommerce cart subtotal: Display 'free' instead of '0,00'

左心房为你撑大大i 提交于 2021-01-20 13:01:46
问题 i am searching for a solution to display 'free' instead of €0,00 in the WooCommerce Cart/Checkout. I know, there is a snippet for the Single Produkt itself, but is there a possibillity to change the price label even in the Subtotal/total calulation on the checkout/cart page? add_filter( 'woocommerce_get_price_html', 'price_free_zero_empty', 9999, 2 ); function price_free_zero_empty( $price, $product ){ if ( '' === $product->get_price() || 0 == $product->get_price() ) { $price = '<span class=

Disable “cart needs payment” for a specific coupon code in Woocommerce

蓝咒 提交于 2021-01-05 10:14:14
问题 I need to hide the payment by credit card when I have a specific coupon such as "tcrfam" and when I use any different to this show the payment by card, the idea is that I do not give a coupon of 100% or free and there is no case I ask credit card data. See the example: I tried this code but dont work: add_action('woocommerce_before_checkout_form', 'apply_product_on_coupon'); function apply_product_on_coupon() { global $woocommerce; $coupon_id = 'tcrfam'; if(in_array($coupon_id, $woocommerce-

Disable “cart needs payment” for a specific coupon code in Woocommerce

假如想象 提交于 2021-01-05 10:13:41
问题 I need to hide the payment by credit card when I have a specific coupon such as "tcrfam" and when I use any different to this show the payment by card, the idea is that I do not give a coupon of 100% or free and there is no case I ask credit card data. See the example: I tried this code but dont work: add_action('woocommerce_before_checkout_form', 'apply_product_on_coupon'); function apply_product_on_coupon() { global $woocommerce; $coupon_id = 'tcrfam'; if(in_array($coupon_id, $woocommerce-

Pass Woocommerce Session from admin to front-end

会有一股神秘感。 提交于 2021-01-05 09:00:29
问题 I try to pass datas from admin to front like : WC()->frontend_includes(); WC()->session = new WC_Session_Handler(); WC()->session->set('datas', array( '_email' => "email_here" )); And retrieve them in front. For example here : function action_woocommerce_before_checkout_form($wccm_autocreate_account) { $datas = WC()->session->get('datas'); var_dump($datas); } add_action('woocommerce_before_checkout_form', 'action_woocommerce_before_checkout_form', 10, 1); add_action('woocommerce_before_cart

Pass Woocommerce Session from admin to front-end

百般思念 提交于 2021-01-05 08:58:36
问题 I try to pass datas from admin to front like : WC()->frontend_includes(); WC()->session = new WC_Session_Handler(); WC()->session->set('datas', array( '_email' => "email_here" )); And retrieve them in front. For example here : function action_woocommerce_before_checkout_form($wccm_autocreate_account) { $datas = WC()->session->get('datas'); var_dump($datas); } add_action('woocommerce_before_checkout_form', 'action_woocommerce_before_checkout_form', 10, 1); add_action('woocommerce_before_cart

How to rename a menu tab under WooCommerce tab on WordPress admin dashboard

大城市里の小女人 提交于 2021-01-01 07:12:43
问题 I need help in renaming a tab menu item under woocommerce tab on wordpress admin. We installed a plugin that appears as a submenu on woocommerce tab. Can anyone please help me on this? I found this code below to rename a tab menu, but I dont know what is the tabmenu key of it. Or anyone here how to check tab menu key on my current tab menu items? add_action( 'admin_menu', 'custom_change_admin_label', 99); function custom_change_admin_label() { global $menu; //global $submenu; $menu[5][0] =

How to rename a menu tab under WooCommerce tab on WordPress admin dashboard

為{幸葍}努か 提交于 2021-01-01 07:08:32
问题 I need help in renaming a tab menu item under woocommerce tab on wordpress admin. We installed a plugin that appears as a submenu on woocommerce tab. Can anyone please help me on this? I found this code below to rename a tab menu, but I dont know what is the tabmenu key of it. Or anyone here how to check tab menu key on my current tab menu items? add_action( 'admin_menu', 'custom_change_admin_label', 99); function custom_change_admin_label() { global $menu; //global $submenu; $menu[5][0] =

How to rename a menu tab under WooCommerce tab on WordPress admin dashboard

五迷三道 提交于 2021-01-01 07:08:19
问题 I need help in renaming a tab menu item under woocommerce tab on wordpress admin. We installed a plugin that appears as a submenu on woocommerce tab. Can anyone please help me on this? I found this code below to rename a tab menu, but I dont know what is the tabmenu key of it. Or anyone here how to check tab menu key on my current tab menu items? add_action( 'admin_menu', 'custom_change_admin_label', 99); function custom_change_admin_label() { global $menu; //global $submenu; $menu[5][0] =

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

ぐ巨炮叔叔 提交于 2021-01-01 04:24:00
问题 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' ); }