wordpress

Replace the Variable Price range by the chosen variation price in WooCommerce 3

喜你入骨 提交于 2021-02-10 06:35:09
问题 On WooCommerce I would like to change the Variable single product page layout. Because, when you have an variable product you get this wired price rage ( below product title ) in the Variable Product page and it shows in the shop page as well. For me the standard way is to show the lowest price of the product in the shop as well as product page and change that price according to user selection of variables. I can't believe why. I can remove the price range and show the lowest price using this

Add new fields at the billing address woocommerce

 ̄綄美尐妖づ 提交于 2021-02-10 05:51:32
问题 I want to edit my billing address at my website, where i need to add and delete some others in my account page, which code shall I edit? Thank you in advanced 回答1: Can you please check below code you can add new custom field example. add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' ); function custom_woocommerce_billing_fields( $fields ) { $fields['billing']['billing_options'] = array( 'label' => __('Custom Field', 'woocommerce'), // Add custom field label

Add new fields at the billing address woocommerce

拥有回忆 提交于 2021-02-10 05:51:30
问题 I want to edit my billing address at my website, where i need to add and delete some others in my account page, which code shall I edit? Thank you in advanced 回答1: Can you please check below code you can add new custom field example. add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' ); function custom_woocommerce_billing_fields( $fields ) { $fields['billing']['billing_options'] = array( 'label' => __('Custom Field', 'woocommerce'), // Add custom field label

Sort specific product category cart items at the end in WooCommerce

血红的双手。 提交于 2021-02-10 05:48:07
问题 How to sort items from a defined product category to be at the end of a cart order, for example I want all products that belong to a product category 'bottle' to be at the end of the cart order. I have found this code that sorts by price, but would like to adjust to as described above. add_action( 'woocommerce_cart_loaded_from_session', 'prefix_cart_order_prod_cat' ); function prefix_cart_order_prod_cat() { $products_in_cart = array(); // Assign each product's price to its cart item key (to

Sort specific product category cart items at the end in WooCommerce

我的梦境 提交于 2021-02-10 05:48:07
问题 How to sort items from a defined product category to be at the end of a cart order, for example I want all products that belong to a product category 'bottle' to be at the end of the cart order. I have found this code that sorts by price, but would like to adjust to as described above. add_action( 'woocommerce_cart_loaded_from_session', 'prefix_cart_order_prod_cat' ); function prefix_cart_order_prod_cat() { $products_in_cart = array(); // Assign each product's price to its cart item key (to

Assign a percentage fee to WooCommerce payment methods based on user roles

笑着哭i 提交于 2021-02-10 05:46:12
问题 How do I expand this snippet to include 2 more payment gateways with different fees? The payment gateways I want to add are 'cardgategiropay' and 'cardgateideal' and the fees are 3% and 2% respectively . add_action('woocommerce_cart_calculate_fees', 'sm_credit_card_fee_role_gateway', 10, 1); function sm_credit_card_fee_role_gateway($cart){ if (is_admin() && !defined('DOING_AJAX')) return; if ( ! ( is_checkout() && ! is_wc_endpoint_url('order-pay') ) ) return; if (!is_user_logged_in()) return;

Set an external order ID when creating programmatically a WooCommerce order

女生的网名这么多〃 提交于 2021-02-10 05:35:51
问题 I've been using some well documented code to programatically create Woocommerce orders. Working great. Reference here: https://quadlayers.com/add-products-woocommerce/ However I'd be keen to know if it's possible to define the order_id (or is that the post_id?) whilst creating my WC orders via a script. I run this code on my shop, which currently imports orders into Woocommerce from a marketplace online where orders already have an Order number and I'd be keen to cut out the cross-referencing

Set an external order ID when creating programmatically a WooCommerce order

拟墨画扇 提交于 2021-02-10 05:35:11
问题 I've been using some well documented code to programatically create Woocommerce orders. Working great. Reference here: https://quadlayers.com/add-products-woocommerce/ However I'd be keen to know if it's possible to define the order_id (or is that the post_id?) whilst creating my WC orders via a script. I run this code on my shop, which currently imports orders into Woocommerce from a marketplace online where orders already have an Order number and I'd be keen to cut out the cross-referencing

Add and save a text field in WooCommerce customer order detail pages

心已入冬 提交于 2021-02-10 04:41:32
问题 I have been able to add a custom text input field, in woocommerce's order details page, but I can't save the data submitted data. This is the code: add_action( 'woocommerce_order_details_before_order_table', 'add_custom_Field',10,2 ); function add_custom_Field( $order_id) { $user = wp_get_current_user(); $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id; ?> <form method="post"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">

Add and save a text field in WooCommerce customer order detail pages

时光毁灭记忆、已成空白 提交于 2021-02-10 04:40:47
问题 I have been able to add a custom text input field, in woocommerce's order details page, but I can't save the data submitted data. This is the code: add_action( 'woocommerce_order_details_before_order_table', 'add_custom_Field',10,2 ); function add_custom_Field( $order_id) { $user = wp_get_current_user(); $order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id; ?> <form method="post"> <p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">