orders

Get separate Order's tax totals amounts with tax class

為{幸葍}努か 提交于 2021-02-07 09:29:01
问题 I'm making personal a PDF invoice plugin for woocommerce. Some of our products has tax with Reduced rate (%8) or Standart rate (%18). For example, Product A = Reduced rate (%8), Product B = Standart rate (%18). I can get total of tax amount easily but I want to print with sperate tax total amounts with tax class . How to get total Reduced rate tax amount of an order? Also Standart rate. How can I echo them separately? 回答1: The Tax class is not registered anywhere in the order data… It's

Sort Order Items by “menu order” in WooCommerce order edit pages

倖福魔咒の 提交于 2021-02-07 09:15:58
问题 I use this function to sort Woocommerce order admin items by menu order but But products with variables do not display properly. And if there are several product with variables in the order, only one of them will be displayed. edit: we have problem with multiple items of a product with different attributes: item1: product A,variable a,attribute: red color, qty 12 item2: Product A, variable a, attribute: green color, qty 18 after sort it only shows : item1: product A,variable a,attribute: red

Sort Order Items by “menu order” in WooCommerce order edit pages

橙三吉。 提交于 2021-02-07 09:15:21
问题 I use this function to sort Woocommerce order admin items by menu order but But products with variables do not display properly. And if there are several product with variables in the order, only one of them will be displayed. edit: we have problem with multiple items of a product with different attributes: item1: product A,variable a,attribute: red color, qty 12 item2: Product A, variable a, attribute: green color, qty 18 after sort it only shows : item1: product A,variable a,attribute: red

Get the product ID in WooCommerce 3+ Order items

限于喜欢 提交于 2021-02-07 08:01:49
问题 I am trying to get woocommerce thank you page order_id. Using the code below. But unfortunately I can't get it. add_action( 'woocommerce_thankyou', 'bbloomer_check_order_product_id'); function bbloomer_check_order_product_id( $order_id ){ $order = new WC_Order( $order_id ); $items = $order->get_items(); foreach ( $items as $item ) { $product_id = $item['product_id']; if ( $product_id == XYZ ) { // do something } } } 回答1: This code is outdated for WooCommerce version 3+. You should use instead

Get the order fee item details in Woocommerce 3

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-07 03:28:24
问题 I try to get the name of the fee attached to my order in Woocommerce, I get an array but I don't know how to get the name. I tried with function get_name () but it does not work. $the_order->get_items( array( 'line_item', 'fee', 'shipping' ) ); Raw data output: [137] => WC_Order_Item_Fee Object ( [extra_data:protected] => Array ( [tax_class] => [tax_status] => taxable [amount] => [total] => [total_tax] => [taxes] => Array ( [total] => Array ( ) ) ) [data:protected] => Array ( [order_id] =>

Get the order fee item details in Woocommerce 3

五迷三道 提交于 2021-02-07 03:27:38
问题 I try to get the name of the fee attached to my order in Woocommerce, I get an array but I don't know how to get the name. I tried with function get_name () but it does not work. $the_order->get_items( array( 'line_item', 'fee', 'shipping' ) ); Raw data output: [137] => WC_Order_Item_Fee Object ( [extra_data:protected] => Array ( [tax_class] => [tax_status] => taxable [amount] => [total] => [total_tax] => [taxes] => Array ( [total] => Array ( ) ) ) [data:protected] => Array ( [order_id] =>

Get the order fee item details in Woocommerce 3

自作多情 提交于 2021-02-07 03:26:31
问题 I try to get the name of the fee attached to my order in Woocommerce, I get an array but I don't know how to get the name. I tried with function get_name () but it does not work. $the_order->get_items( array( 'line_item', 'fee', 'shipping' ) ); Raw data output: [137] => WC_Order_Item_Fee Object ( [extra_data:protected] => Array ( [tax_class] => [tax_status] => taxable [amount] => [total] => [total_tax] => [taxes] => Array ( [total] => Array ( ) ) ) [data:protected] => Array ( [order_id] =>

Get orders by meta data via WooCommerce WC_Order_Query

旧城冷巷雨未停 提交于 2021-02-05 09:10:27
问题 How can I get a WooCommerce order by its number (instead of its ID)? I tried using wc_get_orders with custom args, like: wc_get_orders( array( 'number' => '1000' ) ); But it doesn't seem to work. Thanks! 回答1: Order numbers functionality is really enabled through a third party plugin in WooCommerce… Then in this case a new meta_key exist in wp_postmeta database table for shop_order WooCommerce post type which is _order_number . So this parameter doesn't exist by default when using wc_get

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

Get order subtotal value in WooCommerce

痞子三分冷 提交于 2021-02-05 08:28:30
问题 I use the module for calculating delivery by local carrier, but the module don't calculate shipping costs to the total. In the wp-content/plugins/woocommerce/templates/order/order-details.php I added the following code to take the amount of shipping and subtotal: <?php $a = array( get_post_meta($order_id, 'Order_subtotal', true), get_post_meta($order_id, 'Econt_Customer_Shipping_Cost', true)); ?> <tr class="total-cost"> <th><?php _e( 'Total:', 'woocommerce'); ?></th> <td><?php echo array_sum(