orders

WooCommerce Cancelled email notification Not sent when Order expires

試著忘記壹切 提交于 2019-12-04 12:43:43
I have set up the stock in the woocommerce and configure the time for auto cancel the order after some minutes if payments are not done, it is working fine order is canceled after that period but not an email is generated. I have checked the email address and copy the template to my theme but not made any changes yet, To receive the emails, how To fix this issue? Note: New Order email is receiving but not this order canceled. Here is the status of Woocomerce: ### WordPress Environment ### Home URL: https://www.lfp-store.de Site URL: https://www.lfp-store.de WC Version: 3.2.5 Log Directory

WooCommerce - Get the product description by product_id

回眸只為那壹抹淺笑 提交于 2019-12-04 12:14:01
问题 How can I get the product description or the product object using product ID. $order = new WC_Order($order_id); foreach ($order->get_items() as $item) { $product_description = get_the_product_description($item['product_id']); // is there any method can I use to fetch the product description? } The code above extends class WC_Payment_Gateway Any help would be greatly appreciated. 回答1: $order = new WC_Order($order_id); foreach ($order->get_items() as $item) { $product_description = get_post(

Add custom bulk actions to admin orders list in Woocommerce 3

我的梦境 提交于 2019-12-04 11:47:00
In Woocommerce backend (admin) , I have a function that allows the shop-manager to download all orders between two dates with a specific bunch of required data: function write_to_file($date_initial, $date_final) { global $attach_download_dir, $attach_download_file; // Opens/creates file $myfile = fopen($attach_download_dir . '/' . $attach_download_file, "w") or die("Unable to open file!"); // Populates first line fwrite($myfile, 'Date; Parent Order ID; Order ID' . PHP_EOL); // Retrieves orders data if ( isset($date_initial) && isset($date_final) ) $args = array( 'date_created' => $date_initial

Restrict woocommerce order status by role

余生颓废 提交于 2019-12-04 11:44:00
I'm trying to make a workflow where shop managers can create orders and mark them as "pending payment", "processing" but only admins can mark orders as "complete", "failed" etc. The closest I've found was in this post: <?php if ( current_user_can(! 'administrator' ) ) { $args = array( 'post_type' => 'post', 'post_status' => 'publish, pending, draft' ); } else { $args = array( 'post_type' => 'post', 'post_status' => 'publish' ); } $wp_query = new WP_Query($args); while ( have_posts() ) : the_post(); ?> CONTENT <?php endwhile; ?> <?php wp_reset_postdata(); ?> This should work for regular WP

Detecting if the current user has an active subscription

依然范特西╮ 提交于 2019-12-04 11:41:20
问题 I'm developing a website in WordPress with WooCommerce. I'm using additionally WC Paid Listings and WooCommerce Subscriptions plugins to handle my work. The problem is when a user with "subscriber" role with an active subscription login and try to post a content every time he / she has to choose a package even he has an active subscription. Is there anyone with an idea of how to detect if user has an active subscription , if it returns true then the step choosing package skipped? Thanks. 回答1:

Add coupon to the processing order email only if the customer have not used one

孤街醉人 提交于 2019-12-04 11:13:45
I came across this snippet that adds a coupon to the order mail. I would like to make it appear in the processing order mail only if the customer have not used any coupon. add_action( 'woocommerce_email_before_order_table', 'add_content', 20 ); function add_content() { echo '<h2 id="h2thanks">Get 20% off</h2><p id="pthanks">Thank you for making this purchase! Come back and use the code "<strong>Back4More</strong>" to receive a 20% discount on your next purchase! Click here to continue shopping.</p>'; } Thanks. @update 2: New orders are most of the time in 'on-hold' status, but not in

Woocommerce call url (after complete order)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 05:26:27
问题 I have 3 questions (need help): I do not know, how to run this plugin (gives me fatal error) please check my script (I am beginner) Need help with admin page to set up APIkey and choose language for call url http://xxx.CZ or http://xxx.SK (This page is not scripted yet) How to add my plugin admin page to woocommerce admin page? This plugin is for Woocommerce. It is supposed to call specific URL (http://heureka.cz/or .sk/dotaznik/"Clients API set up in admin page in woocommerce"/"Customers

Add the product image to Woocommerce my account order view

安稳与你 提交于 2019-12-04 04:56:29
问题 I would like to add image on my account view order pages in Woocommerce.some one I am able to get the image but the size is too large and I don't know where I need to add this code: <?php // Get a list of all items that belong to the order $products = $order->get_items(); // Loop through the items and get the product image foreach( $products as $product ) { $product_obj = new WC_Product( $product["product_id"] ); echo $product_obj->get_image(); } ?> Any help will be appreciated Here is the

Detecting if the current user has an active subscription

╄→尐↘猪︶ㄣ 提交于 2019-12-04 04:28:56
I'm developing a website in WordPress with WooCommerce. I'm using additionally WC Paid Listings and WooCommerce Subscriptions plugins to handle my work. The problem is when a user with "subscriber" role with an active subscription login and try to post a content every time he / she has to choose a package even he has an active subscription. Is there anyone with an idea of how to detect if user has an active subscription , if it returns true then the step choosing package skipped? Thanks. Updated (2019) New conditional function using WooCommerce Subscriptions wcs_user_has_subscription() . New

MySQL help: How to find all orders from a customer till price <= 20 and status='unpaid'

风流意气都作罢 提交于 2019-12-04 02:42:49
问题 I think my question will be understood better by providing the following example: i have a table with following data: orderid Price username paymentstatus 1 10 john unpaid 2 10 john unpaid 4 10 john unpaid 5 10 john unpaid 6 10 sam unpaid 7 10 john unpaid 8 10 john paid I want to find all orders of (username) john where paymentstatus is "unpaid" and price total is <= 20 So the result should show following 2 lines (as order total is $20 and payment status is unpaid and username is john)