orders

Add to cart with custom data from an url using GET method in Woocommerce 3

有些话、适合烂在心里 提交于 2019-12-24 08:23:03
问题 In Woocommerce, I am adding products to cart using the GET method from an URL like: http://example.com/cart/?add-to-cart=10 Now I would like to be able adding at the same time some custom data as a product note like: http://example.com/cart/?add-to-cart=10&note=hinote And then saving that "hinote" value as the cart item data. Once oder is placed, I would like to save that "hinote" in order item data and display it as custom order item data everywhere. Is that possible? Any help is appreciated

Display parent grouped product name in Woocommerce orders details

岁酱吖の 提交于 2019-12-24 01:06:13
问题 For Woocommerce grouped products I am displaying parent product name in cart and checkout pages using the code bellow: // Adding the grouped product ID custom hidden field data in Cart object add_action( 'woocommerce_add_cart_item_data', 'save_custom_fields_data_to_cart', 10, 2 ); function save_custom_fields_data_to_cart( $cart_item_data, $product_id ) { if( ! empty( $_REQUEST['add-to-cart'] ) && $product_id != $_REQUEST['add-to-cart'] ) { $cart_item_data['custom_data']['grouped_product_id']

Add custom field for WooCommerce CSV Export plugin - For customer first order [closed]

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 00:02:53
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . I'm using Woocommerce CSV Export plugin. I will like to have a way to check if the customer is NEW and if it is, to write in order metadata for a custom meta-key a true value . But if user is not New, nothing will happen. I thought first to start with the creation date of the WP

Show woocommerce product custom fields under the cart and order item name

风流意气都作罢 提交于 2019-12-23 22:26:48
问题 I have a code that shows custom fields in the "General" tab on the product edit page. After the manager has filled these fields, the data is displayed on the Archive/Category pages and in the Single Product page. Also, these fields are in the cart and on the checkout page. Here is my code: // Display Fields using WooCommerce Action Hook add_action( 'woocommerce_product_options_general_product_data', 'woocom_general_product_data_custom_field' ); function woocom_general_product_data_custom

Change Woocommerce email subject if order have this specific category

前提是你 提交于 2019-12-23 21:58:58
问题 I just want to know if possible to change the email subject if the order have the specific category like (Preorder). I want to put PO at beginning (PO New customer order #0000) then all other order the customer receive the default email subject (New Customer Order #0000). add_filter('woocommerce_email_subject_new_order', 'change_admin_email_subject', 1, 2); function change_admin_email_subject( $subject, $order ) { global $woocommerce; global $product; if ( has_term( 'preorder', $product->ID )

Save received data to the order from an external delivery service in Woocommerce 3

蓝咒 提交于 2019-12-23 17:40:28
问题 How to save the order id from delivery service in metadata? add_action('woocommerce_thankyou', 'send_order_to_delivery'); function send_order_to_delivery( $order_id ){ // Send data $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://app.axample.com/api/index.php?new_order"); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT

Display custom fields values in WooCommerce order and email notification

丶灬走出姿态 提交于 2019-12-23 12:39:21
问题 Based on "Choosing a date and time after choosing the WooCommerce delivery method" answer code, that displays custom Pickup fields and delivery dates, the following code displays the delivery data of those fields on the order edit pages. Here is my code: // View fields in Edit Order Page add_action( 'woocommerce_admin_order_data_after_billing_address', 'my_custom_fields_order_meta', 10, 1 ); function my_custom_fields_order_meta($order){ $delivery_option = $order->get_meta('_delivery_option');

Display product optional cost in Woocommerce in order details

流过昼夜 提交于 2019-12-23 10:08:39
问题 Based on "Add a checkbox on single product pages that adds an additional cost in Woocommerce" answer code, I am trying to add an "extra warranty" option to my products (checkbox in product page): /* * add warrenty */ // Backend: Additional pricing option custom field add_action( 'woocommerce_product_options_pricing', 'wc_cost_product_field' ); function wc_cost_product_field() { woocommerce_wp_text_input( array( 'id' => '_warrenty_price', 'class' => 'wc_input_price short', 'label' => __(

Get orders from a SQL query displayed on as a list in Woocommerce

给你一囗甜甜゛ 提交于 2019-12-23 04:06:07
问题 In woocommerce, I'm trying to create a shortcode to put in my function.php document, that displays a custom database query on a page. There's something wrong with it though and i'm not sure what. function sqlquery_shortcode($atts) { global $wpdb; $results = $wpdb->get_results(" SELECT a.order_id, a.order_item_id, a.order_item_name, b.meta_key, b.meta_value FROM 7pW9iX3L_woocommerce_order_items a JOIN 7pW9iX3L_woocommerce_order_itemmeta b ON a.order_item_id = b.order_item_id JOIN 7pW9iX3L

Add a WooCommerce Orders List Column and value

本小妞迷上赌 提交于 2019-12-23 02:42:44
问题 In woo commerce order page(Admin Side) I want to add Drop Shipping column in order list which I done through add_filter( 'manage_edit-shop_order_columns', 'custom_shop_order_column', 20 ); function custom_shop_order_column($columns) { $reordered_columns = array(); // Inserting columns to a specific location foreach( $columns as $key => $column){ $reordered_columns[$key] = $column; if( $key == 'order_total' ){ $reordered_columns['drop_shipping'] = __( 'Drop Shipping','twentyseventeen'); } }