fee

Add a fee to an order programmatically in Woocommerce 3

风流意气都作罢 提交于 2020-01-01 17:04:32
问题 I'm creating Woocommerce totals 'on-the-fly' as my cart items are imported from another CMS. Currently I am having trouble setting a custom 'fee' for each order , then marking the order as 'on-hold': $order->set_date_created($creation_tsz); $order->set_address( $address, 'billing' ); $order->set_address( $address, 'shipping' ); $order->set_currency('GBP'); $order->add_fee('Imported Total', $imported_total_here); $order->set_fee(); $order->calculate_totals(); $order->update_status('on-hold');

Add a fee to an order programmatically in Woocommerce 3

怎甘沉沦 提交于 2020-01-01 17:04:26
问题 I'm creating Woocommerce totals 'on-the-fly' as my cart items are imported from another CMS. Currently I am having trouble setting a custom 'fee' for each order , then marking the order as 'on-hold': $order->set_date_created($creation_tsz); $order->set_address( $address, 'billing' ); $order->set_address( $address, 'shipping' ); $order->set_currency('GBP'); $order->add_fee('Imported Total', $imported_total_here); $order->set_fee(); $order->calculate_totals(); $order->update_status('on-hold');

Add a custom fee for a specific payment gateway in Woocommerce

不问归期 提交于 2019-12-28 06:50:27
问题 How can I add a percentage to the total amount when choosing a payment (credit card)? For example: If the customer pays for cash on delivery, then the base price, and if I chose online payment, then the percentage charged by me is added to the total amount? Gateway ID for cash payment on delivery is set out: cod Gateway ID for online payment is set out: tinkoff add_action( 'woocommerce_after_calculate_totals', 'custom_fee_for_tinkoff' ); function custom_fee_for_tinkoff( $cart ) { if ( is

Force display a zero fee in Woocommerce Orders and email notifications

人走茶凉 提交于 2019-12-24 13:35:40
问题 In Woocommerce, I am trying to get the display of a custom fee, when the fee amount is zero , to make it appear in the order detail table. Based on "Update fee dynamically based on radio buttons in Woocommerce checkout" answer code, I have manage to add a dynamic fee that is applied to cart and changes on customer delivery choice. Here is the working code that I have adapted for my needs: add_action( 'woocommerce_cart_calculate_fees', 'add_delivery_fee', 20, 1 ); function add_delivery_fee(

Woocommerce Progressive extra cost based on total number of items in the cart

谁都会走 提交于 2019-12-23 07:10:52
问题 I am looking for some code which can make an extra charge based on the total number of items in the cart like: If number of items in cart is > 6 ===> extra cost = 5 If number of items in cart is > 12 ==> extra cost = 10 I have tried this code, but I can't get it working for my case. How can I make an extra cost based on total number of items in the cart? 回答1: Based on (this answer) WooCommerce Cart Quantity Base Discount, you can add a progressive fee based on total number of items: add

Progressive cart item fee based on state and on product category in Woocommerce

你。 提交于 2019-12-23 06:51:10
问题 Recently I tryied to use 2 sniped codes in one for this Woocommerce project where I need to set a fee for a specific product category (term ID: 19) and and a specific country state (Florida 'FL') Additionally I should need to multiply this fee rate by the items from this product category (19). This is my actual code: add_action('woocommerce_cart_calculate_fees','woocommerce_custom_surcharge'); function woocommerce_custom_surcharge() { $category_ID = '19'; global $woocommerce; if ( is_admin()

Add a fee based on cart items height in Woocommerce

走远了吗. 提交于 2019-12-11 09:34:40
问题 I'm trying to find a function that automatically adds a fee to the cart if the height of the products in it is over 2,9 cm. I'm using Woocommerce for our simple non-profit comic bookstore. We use weight based shipping as a standard in Sweden, with a bulky fee if something is 3 cm or over. I've tried modifying this answer of LoicTheAztec regarding fees based on total cart weight, but I really don't know what I'm doing as I am getting a blank page after saving the code. The code I'm trying to

Display custom delivery choice on Woocommerce Order totals table

不问归期 提交于 2019-12-11 06:48:55
问题 Based on "Update fee dynamically based on radio buttons in Woocommerce checkout" answer code, I have been able add a custom dynamic fee applied on customer delivery choice (with custom delivery option choices) . Here is the working code that I have adapted for my needs: add_action( 'woocommerce_cart_calculate_fees', 'add_delivery_fee', 20, 1 ); function add_delivery_fee( $cart ) { $domain = 'woocommerce'; $NipostFST = '2000'; $NIPOSTSUB = '250'; if ( is_admin() && ! defined( 'DOING_AJAX' ) )

Shipping cost based on cart total weight in Woocommerce 3

强颜欢笑 提交于 2019-12-08 07:00:05
问题 In my Woocommerce Webshop I do have different Products. I would like to have shipping cost calculated on total cart items weight: from 0 to 6 Kilos the cost is 5 € , from 6 to 12 Kilos the cost is 9 € Actually if I have a Product which is 1 Kilo the shipping cost is 5 € , but if I have 10 items of this product in my basket, the shipping fee is still 5 € (and it should be 9 € instead) . How can I have a progressive shipping cost based on cart total weight? 回答1: Try the following function which

Add a fee to an order programmatically in Woocommerce 3

自闭症网瘾萝莉.ら 提交于 2019-12-04 17:04:40
I'm creating Woocommerce totals 'on-the-fly' as my cart items are imported from another CMS. Currently I am having trouble setting a custom 'fee' for each order , then marking the order as 'on-hold': $order->set_date_created($creation_tsz); $order->set_address( $address, 'billing' ); $order->set_address( $address, 'shipping' ); $order->set_currency('GBP'); $order->add_fee('Imported Total', $imported_total_here); $order->set_fee(); $order->calculate_totals(); $order->update_status('on-hold'); Any track on this will be appreciated. The WC_Abstract_Legacy_Order method add_fee() is deprecated and