hook-woocommerce

Disable WooCommerce email notification for specific product

ⅰ亾dé卋堺 提交于 2019-12-22 00:43:06
问题 I can refer to this function to disable email notification: https://docs.woocommerce.com/document/unhookremove-woocommerce-emails/ But I would like to disable it only for a specific product or, if it can be more simple, for a specific product category. Thanks for your help 回答1: I think when you try to hook email notification from template, where you can find order, at that time emails are already sent. You can try one thing - using recipient's hook you can remove recipient email and return

Passing custom data from cart items to Order meta in Woocommerce 3

六月ゝ 毕业季﹏ 提交于 2019-12-22 00:18:00
问题 I have implemented a custom HTML Form and asking for some data which my customers will pass to place order successfully. Without these details my order has no importance. For HTML form, I am referencing some custom PHP script which is below and which processes POST data from the Form and creates Cart with these data programmatically. Thanks @LoicTheAztec to help me achieve this. The script.php file code: <?php require_once("../wp-load.php"); $customer_name = $_POST["customer_name"]; $customer

Add a drop down to product edit pages in product data “General” settings tab

∥☆過路亽.° 提交于 2019-12-21 22:07:12
问题 I am trying to figure out how to modify the singe product options so the product admin can pick from the drop down list the condition of product, i.e. new/ used. Below is a code that allows product admin to enter the condition of product manually. // Enabling and Displaying Fields in backend add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); function woo_add_custom_general_fields() { global $woocommerce, $post; echo '<div class="options_group">'

Display the customer IP Address in new order email notification

别等时光非礼了梦想. 提交于 2019-12-21 22:02:53
问题 When a new order is created, woocommerce will send an email to admin, and I want it to send customer's IP address inside the email as well. But I can't get it work, here is what I got so far: <?php echo get_post_meta( $order->id, '_customer_ip_address', true ); ?> This code goes in mytheme/woocommerce/emails/admin-new-order.php Any ideas? Thanks. 回答1: (added compatibility for WooCommerce versions 3+) Update 2: Added a condition to display the address IP only for Admin New orders notification.

Move Amazon Button on Woocommerce Checkout Page

不羁岁月 提交于 2019-12-21 21:46:20
问题 I need to move the Amazon Pay message/button on the checkout page in Woocommerce. We are using Amazon Pay by Woocommerce. When I look at the plugin code I have determined that in the plugin's file /woocommerce-gateway-amazon-payments-advanced.php the message/button gets added using: add_action( 'woocommerce_before_checkout_form', array( $this, 'checkout_message' ), 5 ); If I change 'woocommerce_before_checkout_form' to 'woocommerce_after_checkout_form' it moves. I have been struggling to

Adding Extra Add to cart button below product summary in Woocommerce

纵饮孤独 提交于 2019-12-21 20:57:18
问题 In WooCommerce, I am trying to add an extra add to cart button below product summary. I successfully added an extra button following this code which works for single products: add_action( 'woocommerce_single_product_summary', 'custom_button_after_product_summary', 30 ); function custom_button_after_product_summary() { global $product; echo "<a href='".$product->add_to_cart_url()."'>add to cart</a>"; } But if the product is a variation it doesn't work. please suggest as what to do? 回答1: I have

Add custom content to WooCommerce product description

岁酱吖の 提交于 2019-12-21 17:52:40
问题 I'm trying to inject some text in my description ending. Is it possible with filter? Or do i need to do this via child theme? Been trying to find the hook for description but can only find one for short description. Example: This is a description. Just some sample text to fill the description out. What i want is to inject "This is the last line in the description" So the hole description would look like this. This is a description. Just some sample text to fill the description out. This is

Add shortened description under the product title in WooCommerce archive pages

你离开我真会死。 提交于 2019-12-21 05:32:36
问题 In Woocommerce archives pages, I should need to display couple of lines from the product description under each product title like it's shown in this image. How can I do that? 回答1: Updated: This custom function will shorten the product description (to a defined amount of words) and will display it under the title of each product in archive pages as shop: add_action('woocommerce_after_shop_loop_item_title', 'description_in_shop_loop_item', 3 ); function description_in_shop_loop_item() { global

Display cart item count in Woocommerce cart widget

让人想犯罪 __ 提交于 2019-12-20 04:54:21
问题 I am trying to display the count of the items in the cart at the bottom or top of the Woocommerce cart widget. It seems that by default behaviour the cart widget does not do this when in the sidebar. I have researched SO and found the following answer, but it has a slightly different goal of adding individual subtotals. I have tried modifying it, by passing in WC()->cart->get_cart_contents_count() instead of WC()->cart->get_cart() to see if I can get the cart item count, but it's not

Change the user role on purchase for specific products when order status is completed

三世轮回 提交于 2019-12-20 02:49:09
问题 So I helped someone launch a site and they wanted a discounted product when someone purchased a specific product. I found a solution and implemented it and it worked at launch of the site and is no longer changing the role of customers when they purchase the products. I tried to get support from Woothemes and they don't support customization and want them to purchase a $129 extension to handle this. Does anyone out there have a solution for this that still works? Here is my code: // Update