hook-woocommerce

How to add more custom field in Linked Product of Woocommerce

给你一囗甜甜゛ 提交于 2019-11-30 22:11:04
Thanks to all developers at StackOverflow. I want to add more fields in Linked Product Section of Woocommerce. The fields should be similar to Upsell/Crosssell. My code so far:- add_action( 'woocommerce_product_options_linked_product_data', 'woocom_general_product_data_custom_field' ); woocommerce_wp_text_input( array( 'id' => '_upsizing_products', 'label' => __( 'Upsizing Products', 'woocommerce' ), 'placeholder' => 'Upsizing Products', 'desc_tip' => 'true', 'description' => __( 'Select Products Here', 'woocommerce' ) ) ); In the above code i need the combobox, For example when you type 3

Renaming WooCommerce Order Status

与世无争的帅哥 提交于 2019-11-30 14:20:26
I would like to rename the WooCommerce order status from "Completed" to "Order Received". I can edit the script below located in wc-order-functions.php, but I would prefer not to modify any core files or use a plugin. Is it possible to override woocoomerce functions with scripts in child theme's functions.php file? function wc_get_order_statuses() { $order_statuses = array( 'wc-pending' => _x( 'Pending Payment', 'Order status', 'woocommerce' ), 'wc-processing' => _x( 'Processing', 'Order status', 'woocommerce' ), 'wc-on-hold' => _x( 'On Hold', 'Order status', 'woocommerce' ), 'wc-completed' =>

Woocommerce - How to send custom emails based on payment type

╄→尐↘猪︶ㄣ 提交于 2019-11-30 04:47:58
问题 Here is the problem. My woocommerce website has 3 different payment options - Check Payment Western Union Cash On Delivery If my buyer checkout with "Check Payment" I want to send him an automated email that outlines the steps to make a check payment. If he checkout with "Western Union" I want to email him my Western Union information as an automated email. Another automated email should be send for Cash On Delivery. Usually in Woocommerce you have a single email sent to customer for all

Add a new custom checkout field before billing details in Woocommerce?

血红的双手。 提交于 2019-11-30 00:08:04
问题 I can add a set of custom fields to my WooCommerce checkout screen but need to move it above the 'Billing Details'. How can that be done? According to this official WooCommerce documentation, here is an example code to add extra custom checkout fields: /** * Add the field to the checkout */ add_action( 'woocommerce_after_order_notes', 'my_custom_checkout_field' ); function my_custom_checkout_field( $checkout ) { echo '<div id="my_custom_checkout_field"><h2>' . __('My Field') . '</h2>';

Renaming WooCommerce Order Status

孤人 提交于 2019-11-29 20:00:56
问题 I would like to rename the WooCommerce order status from "Completed" to "Order Received". I can edit the script below located in wc-order-functions.php, but I would prefer not to modify any core files or use a plugin. Is it possible to override woocoomerce functions with scripts in child theme's functions.php file? function wc_get_order_statuses() { $order_statuses = array( 'wc-pending' => _x( 'Pending Payment', 'Order status', 'woocommerce' ), 'wc-processing' => _x( 'Processing', 'Order

Exclude related products ids in Woocommerce

ⅰ亾dé卋堺 提交于 2019-11-29 15:53:01
function woocommerce_output_related_products() { $args = array( 'posts_per_page' => 4, 'columns' => 4, 'orderby' => 'rand', // @codingStandardsIgnoreLine. 'post__not_in' => array(502,281) ); woocommerce_related_products( apply_filters( 'woocommerce_output_related_products_args', $args ) ); } I copied this function from includes/wc-template-functions.php into my theme's functions.php To verify that my changes would work I changed the posts_per_page to 3 and it queried only 3 instead of 4. I need to exclude a few products, but post__not_in is not working. Am I doing something wrong? How else can

Rename multiple order statuses in Woocommerce

假装没事ソ 提交于 2019-11-29 15:10:24
I'm trying to rename multiple WooCommerce order status by editing my theme's functions.php file. I found some code posted here a couple years ago that works to change a single order status, but since I'm very inexperienced with php, I don't know how to expand on it to change multiple statuses. Ideally I'd also like to rename 'wc-processing' to 'Paid' and 'wc-on-hold' to 'Pending'. Here's the code I found to edit a single order status: function wc_renaming_order_status( $order_statuses ) { foreach ( $order_statuses as $key => $status ) { $new_order_statuses[ $key ] = $status; if ( 'wc-completed

How to insert Google Merchant Review JS code in WooCommerce Order Complete page

荒凉一梦 提交于 2019-11-29 13:05:34
I want to complete the variables the Google Merchant Review codes asks to be completed on the checkout page: <script src="https://apis.google.com/js/platform.js?onload=renderOptIn" async defer></script> <script> window.renderOptIn = function() { window.gapi.load('surveyoptin', function() { window.gapi.surveyoptin.render( { "merchant_id": mymerchantid, "order_id": "ORDER_ID", "email": "CUSTOMER_EMAIL", "delivery_country": "COUNTRY_CODE", "estimated_delivery_date": "YYYY-MM-DD" }); }); } </script> I need to echo the following variables: ORDER_ID : ID number of the WooCommerce order ID CUSTOMER

Add custom Product data dynamically as item meta data on the Order

不羁的心 提交于 2019-11-29 12:01:27
Is it possible to add a metadata on a product which is inside the Order? In this case, there would be one metadata but each product (in the order) would have different value. Example: Order 1: * Product 1 Sample Meta: Meta1 * Product 2 Sample Meta: Meta2 Thanks. Update1 : I'm now stuck on how would I grab the values from the woocommerce_add_cart_item_data filter. I was able to successfully add the meta data from there. I need to grab those values for me to use in this woocommerce_add_order_item_meta action hook. This is how I successfully added the metadata to the filter: function add_cart

woocommerce change price in checkout and cart page

放肆的年华 提交于 2019-11-29 11:38:01
With woocommerce, in my website I'd like to add in the cart page a select input where the user can select a value between two options, and depending on this value I will change the price. so far, I could get the total and change it using this : function action_woocommerce_before_cart_totals( ) { global $woocommerce; $woocommerce->cart->total = $woocommerce->cart->total*0.25; var_dump( $woocommerce->cart->total);}; The issue is that when I go to checkout page it doesn't take the total calculated in functions.php Thanks for helping me. You can use woocommerce_review_order_before_order_total hook