orders

delete magento order directly which order status is pending_payment

旧时模样 提交于 2020-01-15 11:36:28
问题 here i need to delete pending payment status orders delete using cron job. but i am unable to get pending_payment orders using below code. i think this is not working in my code $orderCollection = Mage::getResourceModel('sales/order_collection'); $orderCollection ->addFieldToFilter('state', 'pending') ->getSelect() ->order('e.entity_id'); here is my full code <?php $mageFilename = 'app/Mage.php'; require_once $mageFilename; Varien_Profiler::enable(); Mage::setIsDeveloperMode(true); ini_set(

Display order total with and without VAT in Woocommerce's order email notification

两盒软妹~` 提交于 2020-01-15 10:18:01
问题 I'm trying to edit the order email to add non-VAT price ! As I've not already found a way to do it the way I wanted using email-order-details.php and as I'm afraid of broking things even in a child theme .php document, I've try to do it with my own snippets, working trough function.php : add_action( 'woocommerce_email_after_order_table', 'add_order_email_instructions', 10, 2 ); function add_order_email_instructions( $order, $sent_to_admin ) { $order_data = $order->get_data(); $order_total =

Display order total with and without VAT in Woocommerce's order email notification

╄→гoц情女王★ 提交于 2020-01-15 10:17:30
问题 I'm trying to edit the order email to add non-VAT price ! As I've not already found a way to do it the way I wanted using email-order-details.php and as I'm afraid of broking things even in a child theme .php document, I've try to do it with my own snippets, working trough function.php : add_action( 'woocommerce_email_after_order_table', 'add_order_email_instructions', 10, 2 ); function add_order_email_instructions( $order, $sent_to_admin ) { $order_data = $order->get_data(); $order_total =

Get a custom field value saved in Order items meta in a hooked function

孤街浪徒 提交于 2020-01-14 05:09:09
问题 I am able to add, validate, display on cart and checkout page a custom field on the Product Page.Please can someone tell me how can I retrieve the custom field values using woocommerce_order_status_completed hook? I want to send an additional email including the custom field data after the confirmation email is sent to the user static function sendCustomData($order_id) { $order = wc_get_order($order_id); $items = $order->get_items(); foreach ($items as $item) { $product_id = $item['product_id

WooCommerce: Merge 3 custom shortcodes in one

亡梦爱人 提交于 2020-01-14 04:22:10
问题 I have three separate woocommerce snippets where each one have one function. I'm trying to combine them together in one script but can't seems to return more than one value. function display_woocommerce_order_count2( $atts, $content = null ) { $args = shortcode_atts( array( 'status' => 'completed', ), $atts ); $statuses = array_map( 'trim', explode( ',', $args['status'] ) ); $order_count = 0; foreach ( $statuses as $status ) { // if we didn't get a wc- prefix, add one if ( 0 !== strpos(

Conditional Cancel Button on my account orders list in Woocommerce

半腔热情 提交于 2020-01-13 20:28:33
问题 This is in reference to Add Cancel button on My account Orders list using Woo Cancel for Customers Plugin answer: I also tried adding the function into functions.php and also get the too few arguments error: I did the same function provided by LoicTheAztec: add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel', 10, 2 ); function custom_valid_order_statuses_for_cancel( $statuses, $order ){ // Set HERE the order statuses where you want the cancel

Conditional Cancel Button on my account orders list in Woocommerce

£可爱£侵袭症+ 提交于 2020-01-13 20:26:24
问题 This is in reference to Add Cancel button on My account Orders list using Woo Cancel for Customers Plugin answer: I also tried adding the function into functions.php and also get the too few arguments error: I did the same function provided by LoicTheAztec: add_filter( 'woocommerce_valid_order_statuses_for_cancel', 'custom_valid_order_statuses_for_cancel', 10, 2 ); function custom_valid_order_statuses_for_cancel( $statuses, $order ){ // Set HERE the order statuses where you want the cancel

Display Custom Total Saving in generated invoice in WooCommerce 3

自闭症网瘾萝莉.ら 提交于 2020-01-13 20:21:07
问题 In WooCommerce I am using WooCommerce Print Invoices & Packing lists plugin… How can I display the total savings of any order in the invoices generated by this plugin ? 1 year ago I have been using this code based on [ this answer ] and that was working before I updated WooCommerce : <?php $discount_total = 0; $_order = wc_get_order( $order_id ); foreach ($_order->get_items() as $order_item) { if ($order_item['variation_id'] > 0) { $line_item = wc_get_product( $order_item['variation_id'] ); }

How to get Order key for creating custom order return url in WooCommerce

試著忘記壹切 提交于 2020-01-13 19:28:30
问题 This is the code that I am using to get a custom Order return URL: global $woocommerce; $test_order = new WC_Order($order_id); $test_order_key = $test_order->order_key; $returnURL = site_url().'/checkout/order-received/7140/'.$test_order_key; The example URL that I need is: http://www.example.com/checkout/order-received/[order_number]/key=[wc-order-key] How do I get [wc-order-key] ? Thanks. 回答1: There is 2 ways to get the order key: 1) From an instance of WC_Order object class using the

Use Woocommerce functions in custom php files

女生的网名这么多〃 提交于 2020-01-13 06:16:08
问题 I am a total beginner in programming with PHP. I wanted to create a PHP file in which the order_status from a predefined order (in my case 108) gets changed to completed. Therefore I need the woocommerce functions get_order($ID) and update_status but I do not know how to use them in my PHP. I hope you understand my problem. From Java I could imagine that I need to get an instance from a class or something like that? Here is the code I have so far: <?php $ord = new WC_Order(108); $ord->update