hook-woocommerce

Add a product subtitle in Woocommerce archives pages

冷暖自知 提交于 2021-02-05 09:23:31
问题 I can add a subtitle to my product title by adding the following code to single-product/title.php: the_title( '<h1 class="product_title entry-title">', '</h1>' ); echo "<p>My subtile</p>"; The problem is that this only appears on the product page. Not on other views such as the shop view: I have looked everywhere and cannot find out where to modify the title for other views of the WooCommerce store? 回答1: Updated - To add a product subtitle in archives pages like shop use the following: add

How to show a product custom field (custom SKU) in WooCommerce orders

瘦欲@ 提交于 2021-02-05 08:51:20
问题 Is there a way to display my custom SKU under each product on the WooCommerce order page? The custom sku displays fine when I edit the product, but it does not display in the order page for the product. I need this information to show on the order so that Zapier can match it with the Visma Account Software ArticleID of the product. This attempt is based on the solution How to add a (second) custom sku field to WooCommerce products? // Add Custom SKU Field function my_add_custom_sku() { $args

Add a new custom field to WooCommerce checkout

吃可爱长大的小学妹 提交于 2021-02-05 08:14:49
问题 I have the code that should work, but for some reason it doesnt. I want to add a new custom field called "City" under Woocommerce checkout, using this code: // Display a custom checkout select field after Billing form add_action( 'woocommerce_after_checkout_billing_form', 'my_custom_checkout_field', 10, 1 ); function my_custom_checkout_field( $checkout ) { echo '<div id="my_custom_checkout_field"> ' . __('City') . ''; woocommerce_form_field( 'delivery_date', array( 'type' => 'select',

Display a product custom field only in WooCommerce Admin single orders

戏子无情 提交于 2021-02-05 08:13:18
问题 This question follows How to show a product custom field (custom SKU) in WooCommerce orders answer to my previous question. How do I make a product custom field articleid (custom SKU) to be visible only in Admin Order edit pages for each order item? Also, it does not work for manual orders. How to display a product custom field articleid (custom SKU) on manual orders too ? 回答1: Updated last function to avoid errors with other order item types that "line items". To make it only visible on

Add a custom checkout field based on cart items quantity in Woocommerce

做~自己de王妃 提交于 2021-02-05 06:17:05
问题 Ultimately I am trying to add a field to checkout in woocommerce when a customer has over a certain quantity in their checkout. For this example I am using 500 and just trying to get a message to show at the bottom of checkout. I have been trying various variations of code and this is what I have so far. add_action( 'woocommerce_after_checkout_form', 'woocommerce_add_quantity_message', 12 ); function woocommerce_add_quantity_message() { global $woocommerce; $total_products = 0; foreach (

Add a custom checkout field based on cart items quantity in Woocommerce

点点圈 提交于 2021-02-05 06:17:05
问题 Ultimately I am trying to add a field to checkout in woocommerce when a customer has over a certain quantity in their checkout. For this example I am using 500 and just trying to get a message to show at the bottom of checkout. I have been trying various variations of code and this is what I have so far. add_action( 'woocommerce_after_checkout_form', 'woocommerce_add_quantity_message', 12 ); function woocommerce_add_quantity_message() { global $woocommerce; $total_products = 0; foreach (

Limit woocommerce orders by IP

喜你入骨 提交于 2021-02-04 19:31:21
问题 I need to prevent selling more than 30 items per day by IP address in woocommerce. Basically, it is protection from bots. I think logic must be something like this: get IP of a customer on a purchase and store it in the order meta check if there are other purchases from that IP at the past 24hr if more then 30 - display an error before payment and ask to return later *user registration is disabled So I'm not sure where to start and how to follow to woocommerce hooks rules. Any code examples

Woocommerce Get Vendor Information with Product ID

南楼画角 提交于 2021-02-04 16:11:06
问题 I am using Woo Commerce with WC Vendor and WC Booking plugin. I want to send booking notification to vendor. Currently it sends notification to Customer and Administrator and when admin changes product status to processing & completed, then it sends notification to vendor. However, I want to send vendor notification along with admin notification. I tried this hook: add_action( 'woocommerce_new_booking', 'new_order_email_to_vendor', 10, 4 ); function new_order_email_to_vendor( $order ){

Display a product custom field only in WooCommerce Admin single orders for Manual Orders

限于喜欢 提交于 2021-02-04 07:56:08
问题 Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which: Adds a Custom SKU Field (ArticleID) Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders However, it seems that the last part (for Manual Orders) is causing a conflict with this following other custom code I added for Gateway Fees: // Assign Card Gateway Percentage Fee to Wholesaler

Change order item displayed meta key label in WooCommerce admin order pages

泄露秘密 提交于 2021-02-04 07:28:11
问题 Following Display a product custom field only in WooCommerce Admin single orders answer to my previous question, which: Adds a Custom SKU Field (ArticleID) Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data Saves the Custom SKU (ArticleID) as Hidden Order Item Meta Data for Manual Orders How can I change the displayed meta key label _articleid on order line items section of the admin single order pages? Right now it shows the "SKU", the "Variation ID" (for product variations) and