How to queue up scheduled actions
Date : March 29 2020, 07:55 AM
around this issue It depends on how much accuracy you need. Do you want users to select the time down to the minute? second? or will allowing them to select the hour they wish to be emailed be enough. If on the hour is accurate enough, then use a task that polls for users to mail every hour.
|
Woocommerce: how to display only scheduled sale products
Date : March 29 2020, 07:55 AM
wish helps you My suggestion is: Copy the sale_products shortcode into you theme(functions.php) or a custom plugin(a php-file inside the plugins folder). Copy the full function named sale_products from /wp-content/plugins/woocommerce/includes/class-wc-shortcodes.php. It starts around line 560. public static function sale_products( $atts ) {
global $woocommerce_loop;
return '<div class="woocommerce columns-' . $columns . '">' . ob_get_clean() . '</div>';
}
public static function sale_products( $atts ) {
function scheduled_sale_products( $atts ) {
add_shortcode( 'scheduled_sale_products', 'scheduled_sale_products' );
$product_ids_on_sale = wc_get_product_ids_on_sale();
$product_ids_raw = $wpdb->get_results(
"SELECT posts.ID, posts.post_parent
FROM `$wpdb->posts` posts
INNER JOIN `$wpdb->postmeta` ON (posts.ID = wp_postmeta.post_id)
INNER JOIN `$wpdb->postmeta` AS mt1 ON (posts.ID = mt1.post_id)
WHERE
posts.post_status = 'publish'
AND (mt1.meta_key = '_sale_price_dates_to' AND mt1.meta_value >= ".time().")
GROUP BY posts.ID
ORDER BY posts.post_title ASC LIMIT 0,12");
$product_ids_on_sale = array();
foreach ( $product_ids_raw as $product_raw )
{
if(!empty($product_raw->post_parent))
{
$product_ids_on_sale[] = $product_raw->post_parent;
}
else
{
$product_ids_on_sale[] = $product_raw->ID;
}
}
$product_ids_on_sale = array_unique($product_ids_on_sale);
[scheduled_sale_products per_page="12"]
|
Woocommerce email on scheduled event
Date : March 29 2020, 07:55 AM
may help you . In your custom WooCommerce email you should have an action in the __construct(), something like: add_action( 'my_custom_email', array( $this, 'trigger' ), 10, 1 );
do_action( 'my_custom_email', $order_id );
global $woocommerce;
$mailer = WC()->mailer();
function my_scheduled_function() {
global $woocommerce;
$mailer = WC()->mailer();
// Lookup $order_id from somewhere
do_action( 'my_custom_email', $order_id );
}
|
How can I add and remove actions in the WooCommerce multiple actions dropdown?
Date : March 29 2020, 07:55 AM
With these it helps To add an action to change order status. Add an action with the index start at "mark_" and then the status name. For example "mark_shipped". add_filter( 'bulk_actions-edit-shop_order', 'custom_shop_order_bulk_actions', 20 );
function custom_shop_order_bulk_actions( $actions ) {
unset( $actions['mark_processing'] ); // remove action
$actions['mark_new_status'] = __( 'Change status to new status' );
return $actions;
}
|
WooCommerce - Add another scheduled sale price
Date : March 29 2020, 07:55 AM
|